Commit eba9ae3c authored by Gildas Bazin's avatar Gildas Bazin Committed by Michael Niedermayer

IWMMXT configure support + runtime selection patch by (Gildas Bazin, gbazin : altern org)

Originally committed as revision 4409 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b4cad537
...@@ -53,6 +53,7 @@ echo " --cpu=CPU force cpu to CPU [$cpu]" ...@@ -53,6 +53,7 @@ echo " --cpu=CPU force cpu to CPU [$cpu]"
echo " --tune=PROCESSOR tune code for a particular CPU (may fails or misperforms on other CPUs)" echo " --tune=PROCESSOR tune code for a particular CPU (may fails or misperforms on other CPUs)"
echo " --powerpc-perf-enable enable performance report on PPC (requires enabling PMC)" echo " --powerpc-perf-enable enable performance report on PPC (requires enabling PMC)"
echo " --disable-mmx disable mmx usage" echo " --disable-mmx disable mmx usage"
echo " --disable-iwmmxt disable iwmmxt usage"
echo " --disable-altivec disable AltiVec usage" echo " --disable-altivec disable AltiVec usage"
echo " --disable-audio-oss disable OSS audio support [default=no]" echo " --disable-audio-oss disable OSS audio support [default=no]"
echo " --disable-audio-beos disable BeOS audio support [default=no]" echo " --disable-audio-beos disable BeOS audio support [default=no]"
...@@ -112,6 +113,7 @@ cpu=`uname -m` ...@@ -112,6 +113,7 @@ cpu=`uname -m`
tune="generic" tune="generic"
powerpc_perf="no" powerpc_perf="no"
mmx="default" mmx="default"
iwmmxt="default"
altivec="default" altivec="default"
mmi="default" mmi="default"
case "$cpu" in case "$cpu" in
...@@ -403,9 +405,9 @@ CODEC_LIST=`grep 'register_avcodec(&[a-z]' $source_path/libavcodec/allcodecs.c ...@@ -403,9 +405,9 @@ CODEC_LIST=`grep 'register_avcodec(&[a-z]' $source_path/libavcodec/allcodecs.c
for opt do for opt do
case "$opt" in case "$opt" in
--prefix=*) prefix=`echo $opt | cut -d '=' -f 2` --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`; force_prefix=yes
;; ;;
--libdir=*) libdir=`echo $opt | cut -d '=' -f 2` --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`; force_libdir=yes
;; ;;
--mandir=*) mandir=`echo $opt | cut -d '=' -f 2` --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
;; ;;
...@@ -413,7 +415,7 @@ for opt do ...@@ -413,7 +415,7 @@ for opt do
;; ;;
--cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2` --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
;; ;;
--cc=*) cc=`echo $opt | cut -d '=' -f 2` --cc=*) cc=`echo $opt | cut -d '=' -f 2-`
;; ;;
--make=*) make=`echo $opt | cut -d '=' -f 2` --make=*) make=`echo $opt | cut -d '=' -f 2`
;; ;;
...@@ -433,6 +435,8 @@ for opt do ...@@ -433,6 +435,8 @@ for opt do
;; ;;
--disable-mmx) mmx="no" --disable-mmx) mmx="no"
;; ;;
--disable-iwmmxt) iwmmxt="no"
;;
--disable-altivec) altivec="no" --disable-altivec) altivec="no"
;; ;;
--enable-gprof) gprof="yes" --enable-gprof) gprof="yes"
...@@ -614,6 +618,20 @@ if test $mmx = "default"; then ...@@ -614,6 +618,20 @@ if test $mmx = "default"; then
fi fi
fi fi
# check iwmmxt support
if test $iwmmxt = "default" -a $cpu = "armv4l"; then
cat > $TMPC << EOF
int main(void) {
__asm__ __volatile__ ("wunpckelub wr6, wr4");
}
EOF
iwmmxt=no
if ${cross_prefix}${cc} -o $TMPO $TMPC 2> /dev/null ; then
iwmmxt=yes
fi
fi
#Darwin CC versions #Darwin CC versions
needmdynamicnopic="no" needmdynamicnopic="no"
if test $targetos = Darwin; then if test $targetos = Darwin; then
...@@ -792,8 +810,8 @@ if test "$mingw32" = "yes" ; then ...@@ -792,8 +810,8 @@ if test "$mingw32" = "yes" ; then
SLIBPREF="" SLIBPREF=""
SLIBSUF=".dll" SLIBSUF=".dll"
EXESUF=".exe" EXESUF=".exe"
prefix="/c/Program Files/FFmpeg" if test "$force_prefix" != yes; then prefix="/c/Program Files/FFmpeg"; fi
bindir="$prefix" if test "$force_libdir" != yes; then bindir="$prefix"; fi
fi fi
cc="${cross_prefix}${cc}" cc="${cross_prefix}${cc}"
...@@ -1144,6 +1162,9 @@ if test $cpu = "x86" -o $cpu = "x86_64"; then ...@@ -1144,6 +1162,9 @@ if test $cpu = "x86" -o $cpu = "x86_64"; then
echo "MMX enabled $mmx" echo "MMX enabled $mmx"
echo "Vector Builtins $builtin_vector" echo "Vector Builtins $builtin_vector"
fi fi
if test $cpu = "armv4l"; then
echo "IWMMXT enabled $iwmmxt"
fi
if test $cpu = "mips"; then if test $cpu = "mips"; then
echo "MMI enabled $mmi" echo "MMI enabled $mmi"
fi fi
...@@ -1299,6 +1320,10 @@ if test "$builtin_vector" = "yes" ; then ...@@ -1299,6 +1320,10 @@ if test "$builtin_vector" = "yes" ; then
echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
fi fi
if test "$iwmmxt" = "yes" ; then
echo "TARGET_IWMMXT=yes" >> config.mak
echo "#define HAVE_IWMMXT 1" >> $TMPH
fi
if test "$mmi" = "yes" ; then if test "$mmi" = "yes" ; then
echo "TARGET_MMI=yes" >> config.mak echo "TARGET_MMI=yes" >> config.mak
echo "#define HAVE_MMI 1" >> $TMPH echo "#define HAVE_MMI 1" >> $TMPH
......
...@@ -240,9 +240,7 @@ void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx) ...@@ -240,9 +240,7 @@ void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx)
c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_arm; //OK c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_arm; //OK
/* c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_arm;//NG */ /* c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_arm;//NG */
#if 1
#ifdef HAVE_IWMMXT #ifdef HAVE_IWMMXT
dsputil_init_iwmmxt(c, avctx); dsputil_init_iwmmxt(c, avctx);
#endif #endif
#endif
} }
...@@ -126,8 +126,26 @@ static void nop(uint8_t *block, const uint8_t *pixels, int line_size, int h) ...@@ -126,8 +126,26 @@ static void nop(uint8_t *block, const uint8_t *pixels, int line_size, int h)
return; return;
} }
int mm_flags; /* multimedia extension flags */
int mm_support(void)
{
return 0; /* TODO, implement proper detection */
}
void dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx) void dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx)
{ {
mm_flags = mm_support();
if (avctx->dsp_mask) {
if (avctx->dsp_mask & FF_MM_FORCE)
mm_flags |= (avctx->dsp_mask & 0xffff);
else
mm_flags &= ~(avctx->dsp_mask & 0xffff);
}
if (!(mm_flags & MM_IWMMXT)) return;
c->add_pixels_clamped = add_pixels_clamped_iwmmxt; c->add_pixels_clamped = add_pixels_clamped_iwmmxt;
c->put_pixels_tab[0][0] = put_pixels16_iwmmxt; c->put_pixels_tab[0][0] = put_pixels16_iwmmxt;
......
...@@ -90,6 +90,8 @@ static void dct_unquantize_h263_inter_iwmmxt(MpegEncContext *s, ...@@ -90,6 +90,8 @@ static void dct_unquantize_h263_inter_iwmmxt(MpegEncContext *s,
void MPV_common_init_iwmmxt(MpegEncContext *s) void MPV_common_init_iwmmxt(MpegEncContext *s)
{ {
if (!(mm_flags & MM_IWMMXT)) return;
s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_iwmmxt; s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_iwmmxt;
#if 0 #if 0
s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_iwmmxt; s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_iwmmxt;
......
...@@ -17,7 +17,7 @@ extern "C" { ...@@ -17,7 +17,7 @@ extern "C" {
#define FFMPEG_VERSION_INT 0x000409 #define FFMPEG_VERSION_INT 0x000409
#define FFMPEG_VERSION "0.4.9-pre1" #define FFMPEG_VERSION "0.4.9-pre1"
#define LIBAVCODEC_BUILD 4756 #define LIBAVCODEC_BUILD 4757
#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
#define LIBAVCODEC_VERSION FFMPEG_VERSION #define LIBAVCODEC_VERSION FFMPEG_VERSION
...@@ -1193,7 +1193,7 @@ typedef struct AVCodecContext { ...@@ -1193,7 +1193,7 @@ typedef struct AVCodecContext {
#define FF_IDCT_SIMPLEARM 10 #define FF_IDCT_SIMPLEARM 10
#define FF_IDCT_H264 11 #define FF_IDCT_H264 11
#define FF_IDCT_VP3 12 #define FF_IDCT_VP3 12
#define FP_IDCT_IPP 13 #define FF_IDCT_IPP 13
/** /**
* slice count. * slice count.
...@@ -1236,6 +1236,9 @@ typedef struct AVCodecContext { ...@@ -1236,6 +1236,9 @@ typedef struct AVCodecContext {
#define FF_MM_SSE2 0x0010 /* PIV SSE2 functions */ #define FF_MM_SSE2 0x0010 /* PIV SSE2 functions */
#define FF_MM_3DNOWEXT 0x0020 /* AMD 3DNowExt */ #define FF_MM_3DNOWEXT 0x0020 /* AMD 3DNowExt */
#endif /* HAVE_MMX */ #endif /* HAVE_MMX */
#ifdef HAVE_IWMMXT
#define FF_MM_IWMMXT 0x0100 /* XScale IWMMXT */
#endif /* HAVE_IWMMXT */
/** /**
* bits per sample/pixel from the demuxer (needed for huffyuv). * bits per sample/pixel from the demuxer (needed for huffyuv).
......
...@@ -432,6 +432,10 @@ void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx); ...@@ -432,6 +432,10 @@ void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);
#define __align8 __attribute__ ((aligned (4))) #define __align8 __attribute__ ((aligned (4)))
#define STRIDE_ALIGN 4 #define STRIDE_ALIGN 4
#define MM_IWMMXT 0x0100 /* XScale IWMMXT */
extern int mm_flags;
void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx); void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx);
#elif defined(HAVE_MLIB) #elif defined(HAVE_MLIB)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment