From 419b878494346c2f9d81f23d7a75cbe03eb5dab0 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 1 Nov 2006 17:01:33 +0000 Subject: [PATCH] Add ARCH_X86_32 as a new define for 32 bit x86 architectures and change the semantics of ARCH_X86 to mean both 32 and 64 bits. Originally committed as revision 6852 to svn://svn.ffmpeg.org/ffmpeg/trunk --- configure | 14 +++++++++----- libavcodec/cabac.h | 10 +++++----- libavcodec/h264.c | 2 +- libavcodec/mathops.h | 2 +- libavutil/common.h | 2 +- libavutil/internal.h | 4 ++-- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/configure b/configure index a55362b7e3..a710a044f6 100755 --- a/configure +++ b/configure @@ -355,10 +355,10 @@ dcbzl="no" mmi="default" case "$arch" in i386|i486|i586|i686|i86pc|BePC) - arch="x86" + arch="x86_32" ;; x86_64|amd64) - arch="x86" + arch="x86"_32 canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`" if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then @@ -1002,7 +1002,7 @@ fi # compute MMX state if test $mmx = "default"; then - if test $arch = "x86" -o $arch = "x86_64"; then + if test $arch = "x86_32" -o $arch = "x86_64"; then mmx="yes" else mmx="no" @@ -1567,7 +1567,7 @@ fi echo "big-endian $bigendian" echo "inttypes.h $inttypes" echo "broken inttypes.h $emu_fast_int" -if test $arch = "x86" -o $arch = "x86_64"; then +if test $arch = "x86_32" -o $arch = "x86_64"; then echo "MMX enabled $mmx" echo "CMOV enabled $cmov" echo "CMOV is fast $cmov_is_fast" @@ -1684,9 +1684,13 @@ echo "SLIBPREF=$SLIBPREF" >> config.mak echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak echo "TARGET_OS=$targetos" >> config.mak -if test "$arch" = "x86" ; then +if test "$arch" = "x86_32" -o "$arch" = "x86_64" ; then echo "TARGET_ARCH_X86=yes" >> config.mak echo "#define ARCH_X86 1" >> $TMPH +fi +if test "$arch" = "x86_32" ; then + echo "TARGET_ARCH_X86_32=yes" >> config.mak + echo "#define ARCH_X86_32 1" >> $TMPH elif test "$arch" = "x86_64" ; then echo "TARGET_ARCH_X86_64=yes" >> config.mak echo "#define ARCH_X86_64 1" >> $TMPH diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h index 9593789e10..8b2e87b3c9 100644 --- a/libavcodec/cabac.h +++ b/libavcodec/cabac.h @@ -379,7 +379,7 @@ static int always_inline get_cabac_inline(CABACContext *c, uint8_t * const state #define BYTE "16" #define BYTEEND "20" #endif -#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) +#if defined(ARCH_X86_32) && !(defined(PIC) && defined(__GNUC__)) int bit; #ifndef BRANCHLESS_CABAC_DECODER @@ -535,7 +535,7 @@ static int always_inline get_cabac_inline(CABACContext *c, uint8_t * const state ); bit&=1; #endif /* BRANCHLESS_CABAC_DECODER */ -#else /* defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) */ +#else /* defined(ARCH_X86_32) && !(defined(PIC) && defined(__GNUC__)) */ int s = *state; int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + s]; int bit, lps_mask attribute_unused; @@ -574,7 +574,7 @@ static int always_inline get_cabac_inline(CABACContext *c, uint8_t * const state if(!(c->low & CABAC_MASK)) refill2(c); #endif /* BRANCHLESS_CABAC_DECODER */ -#endif /* defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) */ +#endif /* defined(ARCH_X86_32) && !(defined(PIC) && defined(__GNUC__)) */ return bit; } @@ -683,7 +683,7 @@ static always_inline int get_cabac_bypass_sign(CABACContext *c, int val){ //FIXME the x86 code from this file should be moved into i386/h264 or cabac something.c/h (note ill kill you if you move my code away from under my fingers before iam finished with it!) //FIXME use some macros to avoid duplicatin get_cabac (cant be done yet as that would make optimization work hard) -#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) +#if defined(ARCH_X86_32) && !(defined(PIC) && defined(__GNUC__)) static int decode_significance_x86(CABACContext *c, int max_coeff, uint8_t *significant_coeff_ctx_base, int *index){ void *end= significant_coeff_ctx_base + max_coeff - 1; int minusstart= -(int)significant_coeff_ctx_base; @@ -789,7 +789,7 @@ static int decode_significance_8x8_x86(CABACContext *c, uint8_t *significant_coe ); return coeff_count; } -#endif /* defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) */ +#endif /* defined(ARCH_X86_32) && !(defined(PIC) && defined(__GNUC__)) */ /** * diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 440c254bf2..a37ea0e374 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -6139,7 +6139,7 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n index[coeff_count++] = last;\ } const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD]; -#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) +#if defined(ARCH_X86_32) && !(defined(PIC) && defined(__GNUC__)) coeff_count= decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index, sig_off); } else { coeff_count= decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index); diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h index db39dedd1c..9ae34d71b2 100644 --- a/libavcodec/mathops.h +++ b/libavcodec/mathops.h @@ -22,7 +22,7 @@ #ifndef MATHOPS_H #define MATHOPS_H -#ifdef ARCH_X86 +#ifdef ARCH_X86_32 #include "i386/mathops.h" diff --git a/libavutil/common.h b/libavutil/common.h index 3ae59716e4..bb049e9628 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -344,7 +344,7 @@ static inline uint64_t read_time(void) ); return (d << 32) | (a & 0xffffffff); } -#elif defined(ARCH_X86) +#elif defined(ARCH_X86_32) static inline long long read_time(void) { long long l; diff --git a/libavutil/internal.h b/libavutil/internal.h index 285d30457f..4f7e525cfd 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -217,7 +217,7 @@ if((y)<(x)){\ static always_inline long int lrintf(float x) { #ifdef __MINGW32__ -# ifdef ARCH_X86 +# ifdef ARCH_X86_32 int32_t i; asm volatile( "fistpl %0\n\t" @@ -227,7 +227,7 @@ static always_inline long int lrintf(float x) # else /* XXX: incorrect, but make it compile */ return (int)(x + (x < 0 ? -0.5 : 0.5)); -# endif /* ARCH_X86 */ +# endif /* ARCH_X86_32 */ #else return (int)(rint(x)); #endif /* __MINGW32__ */