From d638a96c43b3c4fb9b517e8a66a4e8b1fa999833 Mon Sep 17 00:00:00 2001 From: Michał Masłowski Date: Sat, 10 Dec 2011 01:12:48 +0100 Subject: Fix build of patched ffmpeg, disabled since it makes the video green. --- extra/ffmpeg/PKGBUILD | 6 +- extra/ffmpeg/ffmpeg-loongson.patch | 169 ++++++++++++++++--------------------- 2 files changed, 74 insertions(+), 101 deletions(-) diff --git a/extra/ffmpeg/PKGBUILD b/extra/ffmpeg/PKGBUILD index 26eba0f2a..7125acf0d 100644 --- a/extra/ffmpeg/PKGBUILD +++ b/extra/ffmpeg/PKGBUILD @@ -21,14 +21,14 @@ fi source=(ftp://ftp.archlinux.org/other/ffmpeg/${pkgname}-${pkgver}.tar.xz ffmpeg-loongson.patch) md5sums=('8ec30d05efe0f6cc6f702933e6781e8e' - '081d03278559a351322157a441fabcf5') + '99d412cb539f328dbc37d5ead3407fc7') build() { cd "$srcdir/$pkgname" -# [ "$CARCH" = "mips64el" ] && patch -Np1 -i $srcdir/ffmpeg-loongson.patch - if [ "$CARCH" = "mips64el" ] ; then +# Make video decoding faster and turn all pixels green. +# patch -Np1 -i $srcdir/ffmpeg-loongson.patch extraconf="--disable-runtime-cpudetect --disable-vdpau --disable-vaapi" else extraconf="" diff --git a/extra/ffmpeg/ffmpeg-loongson.patch b/extra/ffmpeg/ffmpeg-loongson.patch index 501eafd15..d576812da 100644 --- a/extra/ffmpeg/ffmpeg-loongson.patch +++ b/extra/ffmpeg/ffmpeg-loongson.patch @@ -1,8 +1,7 @@ -diff --git a/configure b/configure -index 25e8cef..1d6c652 100755 ---- a/configure -+++ b/configure -@@ -230,6 +230,7 @@ Advanced options (experts only): +diff -Nru ffmpeg.orig/configure ffmpeg/configure +--- ffmpeg.orig/configure 2011-12-09 21:40:32.268783206 +0100 ++++ ffmpeg/configure 2011-12-09 21:40:50.408820175 +0100 +@@ -249,6 +249,7 @@ --disable-armvfp disable ARM VFP optimizations --disable-iwmmxt disable iwmmxt optimizations --disable-mmi disable MMI optimizations @@ -10,15 +9,15 @@ index 25e8cef..1d6c652 100755 --disable-neon disable neon optimizations --disable-vis disable VIS optimizations --disable-yasm disable use of yasm assembler -@@ -995,6 +996,7 @@ ARCH_EXT_LIST=' - armvfp +@@ -1110,6 +1111,7 @@ + avx iwmmxt mmi + loongson2mmi mmx mmx2 neon -@@ -2862,6 +2864,7 @@ if enabled arm; then +@@ -3367,6 +3369,7 @@ fi if enabled mips; then echo "MMI enabled ${mmi-no}" @@ -26,11 +25,10 @@ index 25e8cef..1d6c652 100755 fi if enabled ppc; then echo "AltiVec enabled ${altivec-no}" -diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -index add4b10..8244e51 100644 ---- a/libavcodec/avcodec.h -+++ b/libavcodec/avcodec.h -@@ -1586,6 +1586,8 @@ typedef struct AVCodecContext { +diff -Nru ffmpeg.orig/libavcodec/avcodec.h ffmpeg/libavcodec/avcodec.h +--- ffmpeg.orig/libavcodec/avcodec.h 2011-12-09 21:40:31.980782616 +0100 ++++ ffmpeg/libavcodec/avcodec.h 2011-12-09 21:40:50.504820368 +0100 +@@ -1824,6 +1824,8 @@ #define FF_IDCT_SIMPLENEON 22 #define FF_IDCT_SIMPLEALPHA 23 #define FF_IDCT_BINK 24 @@ -39,11 +37,10 @@ index add4b10..8244e51 100644 /** * slice count -diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c -index bbfdb6a..dfc3452 100644 ---- a/libavcodec/dsputil.c -+++ b/libavcodec/dsputil.c -@@ -4525,6 +4525,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) +diff -Nru ffmpeg.orig/libavcodec/dsputil.c ffmpeg/libavcodec/dsputil.c +--- ffmpeg.orig/libavcodec/dsputil.c 2011-12-09 21:40:31.912782478 +0100 ++++ ffmpeg/libavcodec/dsputil.c 2011-12-09 21:40:50.568820499 +0100 +@@ -3193,6 +3193,7 @@ if (HAVE_MMI) dsputil_init_mmi (c, avctx); if (ARCH_SH4) dsputil_init_sh4 (c, avctx); if (ARCH_BFIN) dsputil_init_bfin (c, avctx); @@ -51,23 +48,20 @@ index bbfdb6a..dfc3452 100644 for(i=0; i<64; i++){ if(!c->put_2tap_qpel_pixels_tab[0][i]) -diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h -index d1816e6..1a72ae9 100644 ---- a/libavcodec/dsputil.h -+++ b/libavcodec/dsputil.h -@@ -636,6 +636,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx); +diff -Nru ffmpeg.orig/libavcodec/dsputil.h ffmpeg/libavcodec/dsputil.h +--- ffmpeg.orig/libavcodec/dsputil.h 2011-12-09 21:40:31.720782087 +0100 ++++ ffmpeg/libavcodec/dsputil.h 2011-12-09 21:40:50.628820621 +0100 +@@ -650,6 +650,7 @@ void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx); void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx); void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx); +void dsputil_init_loongson2(DSPContext* c, AVCodecContext *avctx); void ff_dsputil_init_dwt(DSPContext *c); - void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx); -diff --git a/libavcodec/loongson2/dsputil_loongson2.c b/libavcodec/loongson2/dsputil_loongson2.c -new file mode 100644 -index 0000000..01bd3ac ---- /dev/null -+++ b/libavcodec/loongson2/dsputil_loongson2.c + void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx); +diff -Nru ffmpeg.orig/libavcodec/loongson2/dsputil_loongson2.c ffmpeg/libavcodec/loongson2/dsputil_loongson2.c +--- ffmpeg.orig/libavcodec/loongson2/dsputil_loongson2.c 1970-01-01 01:00:00.000000000 +0100 ++++ ffmpeg/libavcodec/loongson2/dsputil_loongson2.c 2011-12-09 21:40:50.668820701 +0100 @@ -0,0 +1,221 @@ +/* + * Copyright(C) 2006-2010 comcat @@ -290,11 +284,9 @@ index 0000000..01bd3ac +#endif + +} -diff --git a/libavcodec/loongson2/dsputil_loongson2.d b/libavcodec/loongson2/dsputil_loongson2.d -new file mode 100644 -index 0000000..808f0a3 ---- /dev/null -+++ b/libavcodec/loongson2/dsputil_loongson2.d +diff -Nru ffmpeg.orig/libavcodec/loongson2/dsputil_loongson2.d ffmpeg/libavcodec/loongson2/dsputil_loongson2.d +--- ffmpeg.orig/libavcodec/loongson2/dsputil_loongson2.d 1970-01-01 01:00:00.000000000 +0100 ++++ ffmpeg/libavcodec/loongson2/dsputil_loongson2.d 2011-12-09 21:40:50.680820726 +0100 @@ -0,0 +1,18 @@ +libavcodec/loongson2/dsputil_loongson2.o: \ + libavcodec/loongson2/dsputil_loongson2.c \ @@ -314,24 +306,16 @@ index 0000000..808f0a3 + libavcodec/loongson2/../eval.h libavcodec/loongson2/../parser.h \ + libavcodec/loongson2/../avcodec.h libavcodec/loongson2/../mpeg12data.h \ + libavutil/rational.h libavcodec/loongson2/../rl.h -diff --git a/libavcodec/loongson2/dsputil_loongson2.h b/libavcodec/loongson2/dsputil_loongson2.h -new file mode 100644 -index 0000000..87c7bd9 ---- /dev/null -+++ b/libavcodec/loongson2/dsputil_loongson2.h +diff -Nru ffmpeg.orig/libavcodec/loongson2/dsputil_loongson2.h ffmpeg/libavcodec/loongson2/dsputil_loongson2.h +--- ffmpeg.orig/libavcodec/loongson2/dsputil_loongson2.h 1970-01-01 01:00:00.000000000 +0100 ++++ ffmpeg/libavcodec/loongson2/dsputil_loongson2.h 2011-12-09 21:40:50.692820753 +0100 @@ -0,0 +1,3 @@ +#include "libavcodec/dsputil.h" + +void dsputil_init_pix_loongson2(DSPContext* c, AVCodecContext *avctx); -diff --git a/libavcodec/loongson2/dsputil_loongson2.o b/libavcodec/loongson2/dsputil_loongson2.o -new file mode 100644 -index 0000000..fca0b55 -Binary files /dev/null and b/libavcodec/loongson2/dsputil_loongson2.o differ -diff --git a/libavcodec/loongson2/idct_loongson2.c b/libavcodec/loongson2/idct_loongson2.c -new file mode 100644 -index 0000000..539cab5 ---- /dev/null -+++ b/libavcodec/loongson2/idct_loongson2.c +diff -Nru ffmpeg.orig/libavcodec/loongson2/idct_loongson2.c ffmpeg/libavcodec/loongson2/idct_loongson2.c +--- ffmpeg.orig/libavcodec/loongson2/idct_loongson2.c 1970-01-01 01:00:00.000000000 +0100 ++++ ffmpeg/libavcodec/loongson2/idct_loongson2.c 2011-12-09 21:40:50.744820857 +0100 @@ -0,0 +1,336 @@ +/* + * Copyright (C) 2000-2003 Michel Lespinasse @@ -669,11 +653,9 @@ index 0000000..539cab5 + +declare_idct (ff_loongson2_idct, loongson2_table, + loongson2_row_head, loongson2_row, loongson2_row_tail, loongson2_row_mid) -diff --git a/libavcodec/loongson2/idct_loongson2_xvid.c b/libavcodec/loongson2/idct_loongson2_xvid.c -new file mode 100644 -index 0000000..4a1ee1e ---- /dev/null -+++ b/libavcodec/loongson2/idct_loongson2_xvid.c +diff -Nru ffmpeg.orig/libavcodec/loongson2/idct_loongson2_xvid.c ffmpeg/libavcodec/loongson2/idct_loongson2_xvid.c +--- ffmpeg.orig/libavcodec/loongson2/idct_loongson2_xvid.c 1970-01-01 01:00:00.000000000 +0100 ++++ ffmpeg/libavcodec/loongson2/idct_loongson2_xvid.c 2011-12-09 22:38:11.227175456 +0100 @@ -0,0 +1,301 @@ +/* + * XVID MPEG-4 VIDEO CODEC @@ -713,13 +695,13 @@ index 0000000..4a1ee1e +// Various memory constants (trigonometric values or rounding values) +//----------------------------------------------------------------------------- + -+static const int16_t tg_1_16[4*4] attribute_used __attribute__ ((aligned(8))) = { ++DECLARE_ALIGNED(8, static const int16_t, tg_1_16)[4*4] = { + 13036,13036,13036,13036, // tg * (2<<16) + 0.5 + 27146,27146,27146,27146, // tg * (2<<16) + 0.5 + -21746,-21746,-21746,-21746, // tg * (2<<16) + 0.5 + 23170,23170,23170,23170}; // cos * (2<<15) + 0.5 + -+static const int32_t rounder_0[2*8] attribute_used __attribute__ ((aligned(8))) = { ++DECLARE_ALIGNED(8, static const int32_t, rounder_0)[2*8] = { + 65536,65536, + 3597,3597, + 2260,2260, @@ -731,7 +713,7 @@ index 0000000..4a1ee1e + + +// Table for rows 0,4 - constants are multiplied by cos_4_16 -+static const int16_t tab_i_04_mmx[32*4] attribute_used __attribute__ ((aligned(8))) = { ++DECLARE_ALIGNED(8, static const int16_t, tab_i_04_mmx)[32*4] = { + 16384,16384,16384,-16384, // movq-> w06 w04 w02 w00 + 21407,8867,8867,-21407, // w07 w05 w03 w01 + 16384,-16384,16384,16384, // w14 w12 w10 w08 @@ -771,7 +753,7 @@ index 0000000..4a1ee1e + + +// %3 for rows 0,4 - constants are multiplied by cos_4_16 -+static const int16_t tab_i_04_xmm[32*4] attribute_used __attribute__ ((aligned(8))) = { ++DECLARE_ALIGNED(8, static const int16_t, tab_i_04_xmm)[32*4] = { + 16384,21407,16384,8867, // movq-> w05 w04 w01 w00 + 16384,8867,-16384,-21407, // w07 w06 w03 w02 + 16384,-8867,16384,-21407, // w13 w12 w09 w08 @@ -865,7 +847,7 @@ index 0000000..4a1ee1e + "packsswh $f14, $f14, $f8 \n\t"/* 4 ; y6 y7 y4 y5*/\ + "sdc1 $f6, " #A2 " \n\t"/* 3 ; save y3 y2 y1 y0*/\ + "pshufh $f14, $f14, $f20 \n\t"/* y7 y6 y5 y4*/\ -+ "sdc1 $f14, 8 +" #A2 " \n\t"/* 7 ; save y7 y6 y5 y4*/\ ++ "sdc1 $f14, 8 +" #A2 " \n\t"/* 7 ; save y7 y6 y5 y4*/ + + +#define DCT_8_INV_COL(A1,A2)\ @@ -976,12 +958,9 @@ index 0000000..4a1ee1e + : "r"(block), "r"(rounder_0), "r"(tab_i_04_xmm), "r"(tg_1_16) + :"$f0","$f2","$f4","$f6","$f8","$f10","$f12","$f14","$f18","$f16","$20","$22","$24","$26"); +} -+ -diff --git a/libavcodec/loongson2/motion_est_loongson2.c b/libavcodec/loongson2/motion_est_loongson2.c -new file mode 100644 -index 0000000..bb67290 ---- /dev/null -+++ b/libavcodec/loongson2/motion_est_loongson2.c +diff -Nru ffmpeg.orig/libavcodec/loongson2/motion_est_loongson2.c ffmpeg/libavcodec/loongson2/motion_est_loongson2.c +--- ffmpeg.orig/libavcodec/loongson2/motion_est_loongson2.c 1970-01-01 01:00:00.000000000 +0100 ++++ ffmpeg/libavcodec/loongson2/motion_est_loongson2.c 2011-12-09 23:25:15.247445391 +0100 @@ -0,0 +1,365 @@ +/* + * Loongson2E MMI optimized motion estimation @@ -994,13 +973,13 @@ index 0000000..bb67290 +#include "dsputil_loongson2.h" +#include "../avcodec.h" + -+static const __attribute__ ((aligned(8))) uint64_t round_tab[3]={ ++DECLARE_ASM_CONST(8, uint64_t, round_tab)[3]={ + 0x0000000000000000ULL, + 0x0001000100010001ULL, + 0x0002000200020002ULL, +}; + -+static attribute_used __attribute__ ((aligned(8))) uint64_t bone= 0x0101010101010101LL; ++DECLARE_ASM_CONST(8, uint64_t, bone)= 0x0101010101010101LL; + +static inline void sad8_1_loongson2(uint8_t *blk1, uint8_t *blk2, int stride, int h) +{ @@ -1348,11 +1327,9 @@ index 0000000..bb67290 + c->sad[0]= sad16_loongson2; + c->sad[1]= sad8_loongson2; +} -diff --git a/libavcodec/loongson2/mpegvideo_loongson2.c b/libavcodec/loongson2/mpegvideo_loongson2.c -new file mode 100644 -index 0000000..18d070a ---- /dev/null -+++ b/libavcodec/loongson2/mpegvideo_loongson2.c +diff -Nru ffmpeg.orig/libavcodec/loongson2/mpegvideo_loongson2.c ffmpeg/libavcodec/loongson2/mpegvideo_loongson2.c +--- ffmpeg.orig/libavcodec/loongson2/mpegvideo_loongson2.c 1970-01-01 01:00:00.000000000 +0100 ++++ ffmpeg/libavcodec/loongson2/mpegvideo_loongson2.c 2011-12-09 21:40:50.828821027 +0100 @@ -0,0 +1,385 @@ +/* + * The simplest mpeg encoder (well, it was the simplest!) @@ -1739,10 +1716,9 @@ index 0000000..18d070a +// draw_edges = draw_edges_loongson2; + +} -diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile -index 3f4da68..73e4d56 100644 ---- a/libavcodec/mips/Makefile -+++ b/libavcodec/mips/Makefile +diff -Nru ffmpeg.orig/libavcodec/mips/Makefile ffmpeg/libavcodec/mips/Makefile +--- ffmpeg.orig/libavcodec/mips/Makefile 2011-12-09 21:40:31.700782047 +0100 ++++ ffmpeg/libavcodec/mips/Makefile 2011-12-09 21:40:50.836821045 +0100 @@ -1,3 +1,9 @@ OBJS-$(HAVE_MMI) += ps2/dsputil_mmi.o \ ps2/idct_mmi.o \ @@ -1753,11 +1729,10 @@ index 3f4da68..73e4d56 100644 + loongson2/idct_loongson2_xvid.o \ + loongson2/mpegvideo_loongson2.o \ + loongson2/motion_est_loongson2.o -diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c -index b47ff9a..af92552 100644 ---- a/libavcodec/mpegvideo.c -+++ b/libavcodec/mpegvideo.c -@@ -176,6 +176,9 @@ av_cold int ff_dct_common_init(MpegEncContext *s) +diff -Nru ffmpeg.orig/libavcodec/mpegvideo.c ffmpeg/libavcodec/mpegvideo.c +--- ffmpeg.orig/libavcodec/mpegvideo.c 2011-12-09 21:40:31.644781931 +0100 ++++ ffmpeg/libavcodec/mpegvideo.c 2011-12-09 21:40:50.868821109 +0100 +@@ -182,6 +182,9 @@ #elif ARCH_BFIN MPV_common_init_bfin(s); #endif @@ -1767,11 +1742,10 @@ index b47ff9a..af92552 100644 /* load & permutate scantables note: only wmv uses different ones -diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h -index 5302be9..8d09906 100644 ---- a/libavcodec/mpegvideo.h -+++ b/libavcodec/mpegvideo.h -@@ -689,6 +689,7 @@ int MPV_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, +diff -Nru ffmpeg.orig/libavcodec/mpegvideo.h ffmpeg/libavcodec/mpegvideo.h +--- ffmpeg.orig/libavcodec/mpegvideo.h 2011-12-09 21:40:31.728782103 +0100 ++++ ffmpeg/libavcodec/mpegvideo.h 2011-12-09 21:40:50.892821159 +0100 +@@ -704,6 +704,7 @@ void MPV_common_init_mmx(MpegEncContext *s); void MPV_common_init_axp(MpegEncContext *s); void MPV_common_init_mlib(MpegEncContext *s); @@ -1779,16 +1753,15 @@ index 5302be9..8d09906 100644 void MPV_common_init_mmi(MpegEncContext *s); void MPV_common_init_arm(MpegEncContext *s); void MPV_common_init_altivec(MpegEncContext *s); -diff --git a/libavcodec/options.c b/libavcodec/options.c -index 7ca1062..c05b3f4 100644 ---- a/libavcodec/options.c.orig 2011-06-22 12:52:11.584428161 -0300 -+++ b/libavcodec/options.c 2011-06-22 12:52:25.003143367 -0300 -@@ -219,6 +219,8 @@ static const AVOption options[]={ - {"simple", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLE }, INT_MIN, INT_MAX, V|E|D, "idct"}, - {"simplemmx", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, - {"libmpeg2mmx", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_LIBMPEG2MMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, -+{"libmpeg2loongson2", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_LIBMPEG2LOONGSON2, INT_MIN, INT_MAX, V|E|D, "idct"}, -+{"xvidloongson2", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_XVIDLOONGSON2, INT_MIN, INT_MAX, V|E|D, "idct"}, - {"ps2", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_PS2 }, INT_MIN, INT_MAX, V|E|D, "idct"}, - {"mlib", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_MLIB }, INT_MIN, INT_MAX, V|E|D, "idct"}, - {"arm", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, +diff -Nru ffmpeg.orig/libavcodec/options.c ffmpeg/libavcodec/options.c +--- ffmpeg.orig/libavcodec/options.c 2011-12-09 21:40:31.820782292 +0100 ++++ ffmpeg/libavcodec/options.c 2011-12-09 21:45:31.645390878 +0100 +@@ -251,6 +251,8 @@ + {"simple", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLE }, INT_MIN, INT_MAX, V|E|D, "idct"}, + {"simplemmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, + {"libmpeg2mmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_LIBMPEG2MMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, ++{"libmpeg2loongson2", NULL, 0, AV_OPT_TYPE_CONST, FF_IDCT_LIBMPEG2LOONGSON2, INT_MIN, INT_MAX, V|E|D, "idct"}, ++{"xvidloongson2", NULL, 0, AV_OPT_TYPE_CONST, FF_IDCT_XVIDLOONGSON2, INT_MIN, INT_MAX, V|E|D, "idct"}, + {"ps2", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_PS2 }, INT_MIN, INT_MAX, V|E|D, "idct"}, + {"mlib", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_MLIB }, INT_MIN, INT_MAX, V|E|D, "idct"}, + {"arm", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, -- cgit v1.2.3-54-g00ecf