From bb8e4fad5122cc471a397223b33672a3971f2f55 Mon Sep 17 00:00:00 2001 From: Dominik Mierzejewski Date: Sun, 2 Nov 2008 18:55:09 +0000 Subject: [PATCH] * Sat Nov 01 2008 Dominik Mierzejewski - 0.4.9-0.51.20080908 - reworked build system - build optimized versions where it makes sense - specfile cleanups - enable yasm for optimized asm routines on x86_32 - add obsoletes for Freshrpms' libpostproc subpackage --- ffmpeg-cmov.patch | 12 + ffmpeg-cpu.patch | 541 ++++++++++++++++++++++++++++++++++++++++++++++ ffmpeg.spec | 296 ++++++++++++++++++++----- 3 files changed, 791 insertions(+), 58 deletions(-) create mode 100644 ffmpeg-cmov.patch create mode 100644 ffmpeg-cpu.patch diff --git a/ffmpeg-cmov.patch b/ffmpeg-cmov.patch new file mode 100644 index 0000000..bb3300a --- /dev/null +++ b/ffmpeg-cmov.patch @@ -0,0 +1,12 @@ +diff -up ffmpeg-20080908/configure.cmov ffmpeg-20080908/configure +--- ffmpeg-20080908/configure.cmov 2008-11-01 16:23:33.000000000 +0100 ++++ ffmpeg-20080908/configure 2008-11-01 16:23:33.000000000 +0100 +@@ -1148,6 +1148,8 @@ case "$arch" in + ;; + x86_64|amd64) + arch="x86_32" ++ enable cmov ++ enable fast_cmov + enable fast_unaligned + check_cc <imdct_half = ff_imdct_half_c; + s->exptab1 = NULL; + +-#if defined HAVE_MMX && defined HAVE_YASM ++#if (defined HAVE_MMX || defined HAVE_SSE || defined HAVE_AMD3DNOW) && defined HAVE_YASM + has_vectors = mm_support(); + if (has_vectors & MM_SSE) { ++#ifdef HAVE_SSE + /* SSE for P3/P4/K8 */ + s->imdct_calc = ff_imdct_calc_sse; + s->imdct_half = ff_imdct_half_sse; + s->fft_permute = ff_fft_permute_sse; + s->fft_calc = ff_fft_calc_sse; ++#endif + } else if (has_vectors & MM_3DNOWEXT) { ++#ifdef HAVE_AMD3DNOWEX + /* 3DNowEx for K7 */ + s->imdct_calc = ff_imdct_calc_3dn2; + s->imdct_half = ff_imdct_half_3dn2; + s->fft_calc = ff_fft_calc_3dn2; ++#endif + } else if (has_vectors & MM_3DNOW) { ++#ifdef HAVE_AMD3DNOW + /* 3DNow! for K6-2/3 */ + s->imdct_calc = ff_imdct_calc_3dn; + s->imdct_half = ff_imdct_half_3dn; + s->fft_calc = ff_fft_calc_3dn; ++#endif + } + #elif defined HAVE_ALTIVEC && !defined ALTIVEC_USE_REFERENCE_C_CODE + has_vectors = mm_support(); +diff -up ffmpeg-20080908/libavcodec/Makefile.cpu ffmpeg-20080908/libavcodec/Makefile +--- ffmpeg-20080908/libavcodec/Makefile.cpu 2008-09-02 06:04:26.000000000 +0200 ++++ ffmpeg-20080908/libavcodec/Makefile 2008-11-01 16:23:33.000000000 +0100 +@@ -383,6 +388,12 @@ OBJS += imgresample.o + endif + + # processor-specific code ++ifdef HAVE_AMD3DNOW ++OBJS-$(HAVE_YASM) += i386/fft_3dn.o ++endif ++ifdef HAVE_AMD3DNOWEX ++OBJS-$(HAVE_YASM) += i386/fft_3dn2.o ++endif + ifdef HAVE_MMX + OBJS += i386/fdct_mmx.o \ + i386/cpuid.o \ +@@ -391,12 +402,8 @@ OBJS += i386/fdct_mmx.o \ + i386/motion_est_mmx.o \ + i386/simple_idct_mmx.o \ + i386/idct_mmx_xvid.o \ +- i386/idct_sse2_xvid.o \ + + OBJS-$(HAVE_YASM) += i386/fft_mmx.o \ +- i386/fft_sse.o \ +- i386/fft_3dn.o \ +- i386/fft_3dn2.o \ + i386/dsputil_yasm.o \ + + OBJS-$(CONFIG_GPL) += i386/idct_mmx.o +@@ -414,6 +426,12 @@ OBJS-$(CONFIG_VP6A_DECODER) + + OBJS-$(CONFIG_VP6F_DECODER) += i386/vp3dsp_mmx.o i386/vp3dsp_sse2.o + OBJS-$(CONFIG_WMV3_DECODER) += i386/vc1dsp_mmx.o + endif ++ifdef HAVE_SSE ++OBJS-$(HAVE_YASM) += i386/fft_sse.o ++endif ++ifdef HAVE_SSE2 ++OBJS += i386/idct_sse2_xvid.o ++endif + + ASM_OBJS-$(ARCH_ARMV4L) += armv4l/jrevdct_arm.o \ + armv4l/simple_idct_arm.o \ +diff -up ffmpeg-20080908/libpostproc/postprocess.c.cpu ffmpeg-20080908/libpostproc/postprocess.c +--- ffmpeg-20080908/libpostproc/postprocess.c.cpu 2008-09-01 20:00:53.000000000 +0200 ++++ ffmpeg-20080908/libpostproc/postprocess.c 2008-11-01 16:23:33.000000000 +0100 +@@ -83,7 +83,7 @@ try to unroll inner for(x=0 ... loop to + #include + #endif + //#undef HAVE_MMX2 +-//#define HAVE_3DNOW ++//#define HAVE_AMD3DNOW + //#undef HAVE_MMX + //#undef ARCH_X86 + //#define DEBUG_BRIGHTNESS +@@ -567,7 +567,7 @@ static av_always_inline void do_a_debloc + + #if defined(ARCH_X86) + +-#if (defined (HAVE_MMX) && !defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT) ++#if (defined (HAVE_MMX) && !defined (HAVE_AMD3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT) + #define COMPILE_MMX + #endif + +@@ -575,20 +575,20 @@ static av_always_inline void do_a_debloc + #define COMPILE_MMX2 + #endif + +-#if (defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT) ++#if (defined (HAVE_AMD3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT) + #define COMPILE_3DNOW + #endif + #endif /* defined(ARCH_X86) */ + + #undef HAVE_MMX + #undef HAVE_MMX2 +-#undef HAVE_3DNOW ++#undef HAVE_AMD3DNOW + #undef HAVE_ALTIVEC + + #ifdef COMPILE_C + #undef HAVE_MMX + #undef HAVE_MMX2 +-#undef HAVE_3DNOW ++#undef HAVE_AMD3DNOW + #define RENAME(a) a ## _C + #include "postprocess_template.c" + #endif +@@ -606,7 +606,7 @@ static av_always_inline void do_a_debloc + #undef RENAME + #define HAVE_MMX + #undef HAVE_MMX2 +-#undef HAVE_3DNOW ++#undef HAVE_AMD3DNOW + #define RENAME(a) a ## _MMX + #include "postprocess_template.c" + #endif +@@ -616,7 +616,7 @@ static av_always_inline void do_a_debloc + #undef RENAME + #define HAVE_MMX + #define HAVE_MMX2 +-#undef HAVE_3DNOW ++#undef HAVE_AMD3DNOW + #define RENAME(a) a ## _MMX2 + #include "postprocess_template.c" + #endif +@@ -626,7 +626,7 @@ static av_always_inline void do_a_debloc + #undef RENAME + #define HAVE_MMX + #undef HAVE_MMX2 +-#define HAVE_3DNOW ++#define HAVE_AMD3DNOW + #define RENAME(a) a ## _3DNow + #include "postprocess_template.c" + #endif +@@ -665,7 +665,7 @@ static inline void postProcess(const uin + #else //RUNTIME_CPUDETECT + #ifdef HAVE_MMX2 + postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); +-#elif defined (HAVE_3DNOW) ++#elif defined (HAVE_AMD3DNOW) + postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); + #elif defined (HAVE_MMX) + postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); +diff -up ffmpeg-20080908/libpostproc/postprocess_template.c.cpu ffmpeg-20080908/libpostproc/postprocess_template.c +--- ffmpeg-20080908/libpostproc/postprocess_template.c.cpu 2008-05-09 13:56:36.000000000 +0200 ++++ ffmpeg-20080908/libpostproc/postprocess_template.c 2008-11-01 16:23:33.000000000 +0100 +@@ -33,7 +33,7 @@ + + #ifdef HAVE_MMX2 + #define REAL_PAVGB(a,b) "pavgb " #a ", " #b " \n\t" +-#elif defined (HAVE_3DNOW) ++#elif defined (HAVE_AMD3DNOW) + #define REAL_PAVGB(a,b) "pavgusb " #a ", " #b " \n\t" + #endif + #define PAVGB(a,b) REAL_PAVGB(a,b) +@@ -179,7 +179,7 @@ static inline int RENAME(vertClassify)(u + #ifndef HAVE_ALTIVEC + static inline void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext *c) + { +-#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#if defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + src+= stride*3; + asm volatile( //"movv %0 %1 %2\n\t" + "movq %2, %%mm0 \n\t" // QP,..., QP +@@ -306,7 +306,7 @@ static inline void RENAME(doVertLowPass) + : "r" (src), "r" ((long)stride), "m" (c->pQPb) + : "%"REG_a, "%"REG_c + ); +-#else //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#else //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + const int l1= stride; + const int l2= stride + l1; + const int l3= stride + l2; +@@ -345,7 +345,7 @@ static inline void RENAME(doVertLowPass) + + src++; + } +-#endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#endif //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + } + #endif //HAVE_ALTIVEC + +@@ -364,7 +364,7 @@ static inline void RENAME(doVertLowPass) + */ + static inline void RENAME(vertRK1Filter)(uint8_t *src, int stride, int QP) + { +-#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#if defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + src+= stride*3; + // FIXME rounding + asm volatile( +@@ -426,7 +426,7 @@ static inline void RENAME(vertRK1Filter) + : "r" (src), "r" ((long)stride) + : "%"REG_a, "%"REG_c + ); +-#else //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#else //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + const int l1= stride; + const int l2= stride + l1; + const int l3= stride + l2; +@@ -449,7 +449,7 @@ static inline void RENAME(vertRK1Filter) + } + } + +-#endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#endif //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + } + #endif //0 + +@@ -462,7 +462,7 @@ static inline void RENAME(vertRK1Filter) + */ + static inline void RENAME(vertX1Filter)(uint8_t *src, int stride, PPContext *co) + { +-#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#if defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + src+= stride*3; + + asm volatile( +@@ -548,7 +548,7 @@ static inline void RENAME(vertX1Filter)( + : "r" (src), "r" ((long)stride), "m" (co->pQPb) + : "%"REG_a, "%"REG_c + ); +-#else //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#else //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + + const int l1= stride; + const int l2= stride + l1; +@@ -582,13 +582,13 @@ static inline void RENAME(vertX1Filter)( + } + src++; + } +-#endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#endif //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + } + + #ifndef HAVE_ALTIVEC + static inline void RENAME(doVertDefFilter)(uint8_t src[], int stride, PPContext *c) + { +-#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#if defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + /* + uint8_t tmp[16]; + const int l1= stride; +@@ -1101,7 +1101,7 @@ static inline void RENAME(doVertDefFilte + : "r" ((long)stride), "m" (c->pQPb) + : "%"REG_a, "%"REG_c + ); +-#else //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#else //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + const int l1= stride; + const int l2= stride + l1; + const int l3= stride + l2; +@@ -1139,14 +1139,14 @@ static inline void RENAME(doVertDefFilte + } + src++; + } +-#endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#endif //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + } + #endif //HAVE_ALTIVEC + + #ifndef HAVE_ALTIVEC + static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c) + { +-#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#if defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + asm volatile( + "pxor %%mm6, %%mm6 \n\t" + "pcmpeqb %%mm7, %%mm7 \n\t" +@@ -1370,7 +1370,7 @@ DERING_CORE((%0, %1, 8) ,(%%REGd, %1, + : : "r" (src), "r" ((long)stride), "m" (c->pQPb), "m"(c->pQPb2) + : "%"REG_a, "%"REG_d, "%"REG_c + ); +-#else //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#else //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + int y; + int min=255; + int max=0; +@@ -1487,7 +1487,7 @@ DERING_CORE((%0, %1, 8) ,(%%REGd, %1, + // src[0] = src[7]=src[stride*7]=src[stride*7 + 7]=255; + } + #endif +-#endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#endif //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + } + #endif //HAVE_ALTIVEC + +@@ -1499,7 +1499,7 @@ DERING_CORE((%0, %1, 8) ,(%%REGd, %1, + */ + static inline void RENAME(deInterlaceInterpolateLinear)(uint8_t src[], int stride) + { +-#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#if defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + src+= 4*stride; + asm volatile( + "lea (%0, %1), %%"REG_a" \n\t" +@@ -1552,7 +1552,7 @@ static inline void RENAME(deInterlaceInt + */ + static inline void RENAME(deInterlaceInterpolateCubic)(uint8_t src[], int stride) + { +-#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#if defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + src+= stride*3; + asm volatile( + "lea (%0, %1), %%"REG_a" \n\t" +@@ -1594,7 +1594,7 @@ DEINT_CUBIC((%%REGd, %1), (%0, %1, 8) , + : : "r" (src), "r" ((long)stride) + : "%"REG_a, "%"REG_d, "%"REG_c + ); +-#else //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#else //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + int x; + src+= stride*3; + for(x=0; x<8; x++){ +@@ -1604,7 +1604,7 @@ DEINT_CUBIC((%%REGd, %1), (%0, %1, 8) , + src[stride*9] = CLIP((-src[stride*6] + 9*src[stride*8] + 9*src[stride*10] - src[stride*12])>>4); + src++; + } +-#endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#endif //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + } + + /** +@@ -1616,7 +1616,7 @@ DEINT_CUBIC((%%REGd, %1), (%0, %1, 8) , + */ + static inline void RENAME(deInterlaceFF)(uint8_t src[], int stride, uint8_t *tmp) + { +-#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#if defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + src+= stride*4; + asm volatile( + "lea (%0, %1), %%"REG_a" \n\t" +@@ -1665,7 +1665,7 @@ DEINT_FF((%%REGd, %1), (%%REGd, %1, 2), + : : "r" (src), "r" ((long)stride), "r"(tmp) + : "%"REG_a, "%"REG_d + ); +-#else //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#else //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + int x; + src+= stride*4; + for(x=0; x<8; x++){ +@@ -1683,7 +1683,7 @@ DEINT_FF((%%REGd, %1), (%%REGd, %1, 2), + + src++; + } +-#endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#endif //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + } + + /** +@@ -1695,7 +1695,7 @@ DEINT_FF((%%REGd, %1), (%%REGd, %1, 2), + */ + static inline void RENAME(deInterlaceL5)(uint8_t src[], int stride, uint8_t *tmp, uint8_t *tmp2) + { +-#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#if defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + src+= stride*4; + asm volatile( + "lea (%0, %1), %%"REG_a" \n\t" +@@ -1755,7 +1755,7 @@ DEINT_L5(%%mm1, %%mm0, (%%REGd, %1, 2), + : : "r" (src), "r" ((long)stride), "r"(tmp), "r"(tmp2) + : "%"REG_a, "%"REG_d + ); +-#else //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#else //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + int x; + src+= stride*4; + for(x=0; x<8; x++){ +@@ -1784,7 +1784,7 @@ DEINT_L5(%%mm1, %%mm0, (%%REGd, %1, 2), + + src++; + } +-#endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#endif //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + } + + /** +@@ -1796,7 +1796,7 @@ DEINT_L5(%%mm1, %%mm0, (%%REGd, %1, 2), + */ + static inline void RENAME(deInterlaceBlendLinear)(uint8_t src[], int stride, uint8_t *tmp) + { +-#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#if defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + src+= 4*stride; + asm volatile( + "lea (%0, %1), %%"REG_a" \n\t" +@@ -1843,7 +1843,7 @@ static inline void RENAME(deInterlaceBle + : : "r" (src), "r" ((long)stride), "r" (tmp) + : "%"REG_a, "%"REG_d + ); +-#else //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#else //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + int a, b, c, x; + src+= 4*stride; + +@@ -1886,7 +1886,7 @@ static inline void RENAME(deInterlaceBle + src += 4; + tmp += 4; + } +-#endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#endif //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + } + + /** +@@ -2191,7 +2191,7 @@ static inline void RENAME(tempNoiseReduc + + #define FAST_L2_DIFF + //#define L1_DIFF //u should change the thresholds too if u try that one +-#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#if defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + asm volatile( + "lea (%2, %2, 2), %%"REG_a" \n\t" // 3*stride + "lea (%2, %2, 4), %%"REG_d" \n\t" // 5*stride +@@ -2479,7 +2479,7 @@ L2_DIFF_CORE((%0, %%REGc) , (%1, %%REGc + :: "r" (src), "r" (tempBlurred), "r"((long)stride), "m" (tempBlurredPast) + : "%"REG_a, "%"REG_d, "%"REG_c, "memory" + ); +-#else //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#else //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + { + int y; + int d=0; +@@ -2562,7 +2562,7 @@ Switch between + } + } + } +-#endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW) ++#endif //defined (HAVE_MMX2) || defined (HAVE_AMD3DNOW) + } + #endif //HAVE_ALTIVEC + +@@ -3411,7 +3411,7 @@ static void RENAME(postProcess)(const ui + : "%"REG_a, "%"REG_d + ); + +-#elif defined(HAVE_3DNOW) ++#elif defined(HAVE_AMD3DNOW) + //FIXME check if this is faster on an 3dnow chip or if it is faster without the prefetch or ... + /* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32); + prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32); +@@ -3547,7 +3547,7 @@ static void RENAME(postProcess)(const ui + : "%"REG_a, "%"REG_d + ); + +-#elif defined(HAVE_3DNOW) ++#elif defined(HAVE_AMD3DNOW) + //FIXME check if this is faster on an 3dnow chip or if it is faster without the prefetch or ... + /* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32); + prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32); +@@ -3699,7 +3699,7 @@ static void RENAME(postProcess)(const ui + + dstBlock[x +14*dstStride] + dstBlock[x +15*dstStride]; + }*/ + } +-#ifdef HAVE_3DNOW ++#ifdef HAVE_AMD3DNOW + asm volatile("femms"); + #elif defined (HAVE_MMX) + asm volatile("emms"); diff --git a/ffmpeg.spec b/ffmpeg.spec index ae1b47b..0e31868 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -6,12 +6,14 @@ Summary: Digital VCR and streaming server Name: ffmpeg Version: 0.4.9 -Release: 0.50.%{svn}%{?dist} +Release: 0.51.%{svn}%{?dist} License: GPLv2+ Group: Applications/Multimedia URL: http://ffmpeg.org/ Source0: http://rpm.greysector.net/livna/%{name}-%{svn}.tar.bz2 Source1: %{name}-snapshot.sh +Patch0: %{name}-cpu.patch +Patch1: %{name}-cmov.patch Patch4: %{name}-asmreg.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -29,8 +31,10 @@ BuildRequires: imlib2-devel BuildRequires: texi2html BuildRequires: faac-devel BuildRequires: x264-devel >= 0.0.0-0.14.20080613 -#don't enable until PIC issues on x86_64 are fixed ('ff_imdct_half_sse' in libavcodec/i386/fft_sse.c) -#BuildRequires: yasm +#don't enable on x86_64 until PIC issues on are fixed (in libavcodec/i386/fft_mmx.asm) +%ifarch %{ix86} +BuildRequires: yasm +%endif %description FFMpeg is a complete and free Internet live audio and video @@ -42,6 +46,7 @@ and video, MPEG4, h263, ac3, asf, avi, real, mjpeg, and flash. Summary: Libraries for %{name} Group: System Environment/Libraries Requires: faad2-libs >= %{faad2min} +Obsoletes: ffmpeg-libpostproc < 0.4.9-0.11 %description libs FFMpeg is a complete and free Internet live audio and video @@ -55,6 +60,15 @@ Summary: Development package for %{name} Group: Development/Libraries Requires: %{name}-libs = %{version}-%{release} Requires: pkgconfig +%ifarch %{ix86} +Requires: %{name}-libs-sse2 = %{version}-%{release} +%endif +%ifarch ppc ppc64 +Requires: %{name}-libs-altivec = %{version}-%{release} +%endif +%ifarch sparc sparc64 +Requires: %{name}-libs-vis = %{version}-%{release} +%endif %description devel FFMpeg is a complete and free Internet live audio and video @@ -63,50 +77,183 @@ VCR. It can encode in real time in many formats including MPEG1 audio and video, MPEG4, h263, ac3, asf, avi, real, mjpeg, and flash. This package contains development files for %{name} +%ifarch %{ix86} +%package libs-sse2 +Summary: SSE2-enabled Libraries for %{name} +Group: System Environment/Libraries +Requires: faad2-libs >= %{faad2min} + +%description libs-sse2 +FFMpeg is a complete and free Internet live audio and video +broadcasting solution for Linux/Unix. It also includes a digital +VCR. It can encode in real time in many formats including MPEG1 audio +and video, MPEG4, h263, ac3, asf, avi, real, mjpeg, and flash. +This package contains the SSE2-enabled libraries for %{name} +%endif +%ifarch ppc ppc64 +%package libs-altivec +Summary: AltiVec-enabled Libraries for %{name} +Group: System Environment/Libraries +Requires: faad2-libs >= %{faad2min} + +%description libs-altivec +FFMpeg is a complete and free Internet live audio and video +broadcasting solution for Linux/Unix. It also includes a digital +VCR. It can encode in real time in many formats including MPEG1 audio +and video, MPEG4, h263, ac3, asf, avi, real, mjpeg, and flash. +This package contains the AltiVec-enabled libraries for %{name} +%endif +%ifarch sparc sparc64 +%package libs-vis +Summary: VIS-enabled Libraries for %{name} +Group: System Environment/Libraries +Requires: faad2-libs >= %{faad2min} + +%description libs-vis +FFMpeg is a complete and free Internet live audio and video +broadcasting solution for Linux/Unix. It also includes a digital +VCR. It can encode in real time in many formats including MPEG1 audio +and video, MPEG4, h263, ac3, asf, avi, real, mjpeg, and flash. +This package contains the VIS-enabled libraries for %{name} +%endif + +%define ff_configure \ +../configure \\\ + --prefix=%{_prefix} \\\ + --incdir=%{_includedir}/ffmpeg \\\ + --libdir=%{_libdir} \\\ + --mandir=%{_mandir} \\\ + --arch=%{_target_cpu} \\\ + --extra-cflags="$RPM_OPT_FLAGS" \\\ + %{?_with_amr:--enable-libamr-nb --enable-libamr-wb --enable-nonfree} \\\ + --enable-libdc1394 \\\ + --enable-libfaac \\\ + --enable-libfaad \\\ + --enable-libgsm \\\ + --enable-libmp3lame \\\ + --enable-libtheora \\\ + --enable-libvorbis \\\ + --enable-libx264 \\\ + --enable-libxvid \\\ + --enable-x11grab \\\ + --enable-avfilter \\\ + --enable-avfilter-lavf \\\ + --enable-postproc \\\ + --enable-swscale \\\ + --enable-pthreads \\\ + --disable-static \\\ + --enable-shared \\\ + --enable-gpl \\\ + --disable-debug \\\ + --disable-optimizations \\\ + --disable-stripping + %prep %setup -q -n %{name}-%{svn} +%patch0 -p1 -b .cpu +%patch1 -p1 -b .cmov %patch4 -p1 -b .asmreg - %build -./configure \ - --prefix=%{_prefix} \ - --incdir=%{_includedir}/ffmpeg \ - --libdir=%{_libdir} \ +mkdir generic +pushd generic +%{ff_configure}\ --shlibdir=%{_libdir} \ - --mandir=%{_mandir} \ - --arch=%{_target_cpu} \ - --extra-cflags="$RPM_OPT_FLAGS -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -fasm -std=c99 -fno-math-errno" \ - %{?_with_amr:--enable-libamr-nb --enable-libamr-wb --enable-nonfree} \ - --enable-libdc1394 \ - --enable-libfaac \ - --enable-libfaad \ - --enable-libgsm \ - --enable-libmp3lame \ - --enable-libtheora \ - --enable-libvorbis \ - --enable-libx264 \ - --enable-libxvid \ - --enable-x11grab \ - --enable-avfilter \ - --enable-avfilter-lavf \ - --enable-postproc \ - --enable-swscale \ - --enable-pthreads \ - --disable-static \ - --enable-shared \ - --enable-gpl \ - --disable-debug \ - --disable-optimizations \ - --disable-stripping - -make %{?_smp_mflags} - +%ifarch %{ix86} + --cpu=%{_target_cpu} \ + --disable-amd3dnow \ + --disable-mmx \ + --disable-sse \ +%endif +%ifarch ppc ppc64 + --disable-altivec \ +%endif +%ifarch sparc sparc64 + --disable-vis \ +%endif +%ifarch x86_64 + --disable-amd3dnow \ +%endif + +make %{?_smp_mflags} +popd + +%ifarch %{ix86} +mkdir sse2 +pushd sse2 +%{ff_configure}\ + --shlibdir=%{_libdir}/sse2 \ + --cpu=i686 \ + --disable-amd3dnow \ + --disable-ssse3 \ + --disable-ffmpeg \ + --disable-ffserver \ + --disable-ffplay \ + +make %{?_smp_mflags} +popd +%endif +%ifarch ppc +mkdir altivec +pushd altivec +%{ff_configure}\ + --shlibdir=%{_libdir}/altivec \ + --cpu=g4 \ + --enable-altivec \ + --disable-ffmpeg \ + --disable-ffserver \ + --disable-ffplay \ + +popd +%endif +%ifarch ppc64 +mkdir altivec +pushd altivec +%{ff_configure}\ + --shlibdir=%{_libdir}/altivec \ + --cpu=g5 \ + --enable-altivec \ + --disable-ffmpeg \ + --disable-ffserver \ + --disable-ffplay \ + +popd +%endif +%ifarch sparc sparc64 +mkdir vis +pushd vis +%{ff_configure}\ + --shlibdir=%{_libdir}/v9 \ + --cpu=v9 \ + --enable-vis \ + --disable-ffmpeg \ + --disable-ffserver \ + --disable-ffplay \ + +popd +%endif %install rm -rf $RPM_BUILD_ROOT __doc +pushd generic +make install DESTDIR=$RPM_BUILD_ROOT +popd +%ifarch %{ix86} +pushd sse2 +make install DESTDIR=$RPM_BUILD_ROOT +popd +%endif +%ifarch ppc ppc64 +pushd altivec +make install DESTDIR=$RPM_BUILD_ROOT +popd +%endif +%ifarch sparc sparc64 +pushd vis make install DESTDIR=$RPM_BUILD_ROOT +popd +%endif cp -a doc __doc rm -f __doc/{Makefile,*.{1,pl,texi}} @@ -119,6 +266,23 @@ rm -rf $RPM_BUILD_ROOT %postun libs -p /sbin/ldconfig +%ifarch %{ix86} +%post libs-sse2 -p /sbin/ldconfig + +%postun libs-sse2 -p /sbin/ldconfig +%endif + +%ifarch ppc ppc64 +%post libs-altivec -p /sbin/ldconfig + +%postun libs-altivec -p /sbin/ldconfig +%endif + +%ifarch sparc sparc64 +%post libs-vis -p /sbin/ldconfig + +%postun libs-vis -p /sbin/ldconfig +%endif %files %defattr(-,root,root,-) @@ -133,36 +297,52 @@ rm -rf $RPM_BUILD_ROOT %files libs %defattr(-,root,root,-) -%{_libdir}/libavcodec.so.* -%{_libdir}/libavdevice.so.* -%{_libdir}/libavfilter.so.* -%{_libdir}/libavformat.so.* -%{_libdir}/libavutil.so.* -%{_libdir}/libpostproc.so.* -%{_libdir}/libswscale.so.* +%{_libdir}/lib*.so.* %{_libdir}/vhook/ +%ifarch %{ix86} +%files libs-sse2 +%defattr(-,root,root,-) +%{_libdir}/sse2/lib*.so.* +%{_libdir}/sse2/vhook/ +%endif +%ifarch ppc ppc64 +%files libs-altivec +%defattr(-,root,root,-) +%{_libdir}/altivec/lib*.so.* +%{_libdir}/altivec/vhook/ +%endif +%ifarch sparc sparc64 +%files libs-vis +%defattr(-,root,root,-) +%{_libdir}/v9/lib*.so.* +%{_libdir}/v9/vhook/ +%endif + %files devel %defattr(-,root,root,-) -# Note: as of 20070204, --incdir doesn't affect postproc. %{_includedir}/ffmpeg -%{_libdir}/libavcodec.so -%{_libdir}/libavdevice.so -%{_libdir}/libavfilter.so -%{_libdir}/libavformat.so -%{_libdir}/libavutil.so -%{_libdir}/libpostproc.so -%{_libdir}/libswscale.so -%{_libdir}/pkgconfig/libswscale.pc -%{_libdir}/pkgconfig/libavcodec.pc -%{_libdir}/pkgconfig/libavdevice.pc -%{_libdir}/pkgconfig/libavfilter.pc -%{_libdir}/pkgconfig/libavformat.pc -%{_libdir}/pkgconfig/libavutil.pc -%{_libdir}/pkgconfig/libpostproc.pc +%{_libdir}/pkgconfig/lib*.pc +%{_libdir}/lib*.so +%ifarch %{ix86} +%{_libdir}/sse2/lib*.so +%endif +%ifarch ppc ppc64 +%{_libdir}/altivec/lib*.so +%endif +%ifarch sparc sparc64 +%{_libdir}/v9/lib*.so +%endif %changelog +* Sat Nov 01 2008 Dominik Mierzejewski - 0.4.9-0.51.20080908 +- reworked build system +- build optimized versions where it makes sense +- specfile cleanups +- enable yasm for optimized asm routines on x86_32 +- add obsoletes for Freshrpms' libpostproc subpackage + * Thu Sep 18 2008 Dominik Mierzejewski - 0.4.9-0.50.20080908 - 20080908 snapshot (r25261), last before ABI change