From 803ba42b08db6cb6be55f1dfd0f5e31cbcd43715 Mon Sep 17 00:00:00 2001 From: ajacoutot Date: Sun, 8 Apr 2007 17:31:01 +0000 Subject: [PATCH] Import x264-20070325 x264 is a free library for encoding H264/AVC video streams. This program requires a processor with recent instructions (MMX/SSE for i386, AltiVec for powerpc). Encoder features: * CAVLC/CABAC * Multi-references * Intra: all macroblock types (16x16, 8x8, and 4x4 with all predictions) * Inter P: all partitions (from 16x16 down to 4x4) * Inter B: partitions from 16x16 down to 8x8 (including skip/direct) * Ratecontrol: constant quantizer, single or multipass ABR, optional VBV * Scene cut detection * Adaptive B-frame placement * B-frames as references / arbitrary frame order * 8x8 and 4x4 adaptive spatial transform * Lossless mode * Custom quantization matrices * Parallel encoding of multiple slices * Interlacing based on an original submission by Nikns Siankin help and ok naddy@ steven@ --- multimedia/x264/Makefile | 42 ++++++++++++++++ multimedia/x264/distinfo | 5 ++ multimedia/x264/patches/patch-Makefile | 50 +++++++++++++++++++ multimedia/x264/patches/patch-common_cpu_c | 12 +++++ .../x264/patches/patch-common_ppc_dct_c | 12 +++++ multimedia/x264/patches/patch-common_ppc_mc_c | 16 ++++++ .../x264/patches/patch-common_ppc_pixel_c | 12 +++++ .../x264/patches/patch-common_ppc_quant_c | 12 +++++ multimedia/x264/patches/patch-configure | 38 ++++++++++++++ multimedia/x264/pkg/DESCR | 20 ++++++++ multimedia/x264/pkg/PFRAG.shared | 2 + multimedia/x264/pkg/PLIST | 7 +++ 12 files changed, 228 insertions(+) create mode 100644 multimedia/x264/Makefile create mode 100644 multimedia/x264/distinfo create mode 100644 multimedia/x264/patches/patch-Makefile create mode 100644 multimedia/x264/patches/patch-common_cpu_c create mode 100644 multimedia/x264/patches/patch-common_ppc_dct_c create mode 100644 multimedia/x264/patches/patch-common_ppc_mc_c create mode 100644 multimedia/x264/patches/patch-common_ppc_pixel_c create mode 100644 multimedia/x264/patches/patch-common_ppc_quant_c create mode 100644 multimedia/x264/patches/patch-configure create mode 100644 multimedia/x264/pkg/DESCR create mode 100644 multimedia/x264/pkg/PFRAG.shared create mode 100644 multimedia/x264/pkg/PLIST diff --git a/multimedia/x264/Makefile b/multimedia/x264/Makefile new file mode 100644 index 00000000000..69598dc0999 --- /dev/null +++ b/multimedia/x264/Makefile @@ -0,0 +1,42 @@ +# $OpenBSD: Makefile,v 1.1.1.1 2007/04/08 17:31:01 ajacoutot Exp $ + +COMMENT= "free h264/avc encoder" + +V= 20070325 +DISTNAME= x264-snapshot-${V}-2245 +PKGNAME= x264-${V} +SHARED_LIBS= x264 0.0 # 5.0 +CATEGORIES= multimedia + +HOMEPAGE= http://www.videolan.org/developers/x264.html + +EXTRACT_SUFX= .tar.bz2 + +MAINTAINER= Antoine Jacoutot + +# GPLv2 +PERMIT_PACKAGE_CDROM= Yes +PERMIT_PACKAGE_FTP= Yes +PERMIT_DISTFILES_CDROM= Yes +PERMIT_DISTFILES_FTP= Yes + +MASTER_SITES= ftp://ftp.videolan.org/pub/videolan/x264/snapshots/ + +WANTLIB= c m pthread + +NO_REGRESS= Yes +USE_GMAKE= Yes + +CONFIGURE_STYLE=simple +CONFIGURE_ENV= API=${LIBx264_VERSION} +CONFIGURE_ARGS+=${CONFIGURE_SHARED} \ + --enable-pthread + +.if ${MACHINE_ARCH} == "i386" +BUILD_DEPENDS+= ::devel/nasm +.endif + +pre-configure: + @perl -pi -e 's,!!PREFIX!!,${PREFIX},g' ${WRKSRC}/configure + +.include diff --git a/multimedia/x264/distinfo b/multimedia/x264/distinfo new file mode 100644 index 00000000000..5d2b1e1e377 --- /dev/null +++ b/multimedia/x264/distinfo @@ -0,0 +1,5 @@ +MD5 (x264-snapshot-20070325-2245.tar.bz2) = 6dd6bf315e095d5e564a5622ffd0185f +RMD160 (x264-snapshot-20070325-2245.tar.bz2) = 10379103ae48e6e71905dfe6ef6b75cee792af6a +SHA1 (x264-snapshot-20070325-2245.tar.bz2) = b33d2289bf6cea4360bc4a6560aa338c98b39820 +SHA256 (x264-snapshot-20070325-2245.tar.bz2) = 1e4f4b27edd9afb4505d86f7ae0d6a861662e541cd98144225c51ed6fc717c5c +SIZE (x264-snapshot-20070325-2245.tar.bz2) = 509357 diff --git a/multimedia/x264/patches/patch-Makefile b/multimedia/x264/patches/patch-Makefile new file mode 100644 index 00000000000..df1088b5b9c --- /dev/null +++ b/multimedia/x264/patches/patch-Makefile @@ -0,0 +1,50 @@ +$OpenBSD: patch-Makefile,v 1.1.1.1 2007/04/08 17:31:01 ajacoutot Exp $ +--- Makefile.orig Sun Mar 25 22:45:02 2007 ++++ Makefile Sat Apr 7 13:58:39 2007 +@@ -47,6 +47,9 @@ ALTIVECSRC += common/ppc/mc.c common/ppc/pixel.c commo + common/ppc/quant.c + SRCS += $(ALTIVECSRC) + $(ALTIVECSRC:%.c=%.o): CFLAGS += $(ALTIVECFLAGS) ++$(ALTIVECSRC:%.c=%.so): CFLAGS += $(ALTIVECFLAGS) ++common/cpu.o: CFLAGS += $(ALTIVECFLAGS) ++common/cpu.so: CFLAGS += $(ALTIVECFLAGS) + endif + + # VIS optims +@@ -60,6 +63,7 @@ SRCS += extras/getopt.c + endif + + OBJS = $(SRCS:%.c=%.o) ++SOBJS = $(SRCS:%.c=%.so) + OBJCLI = $(SRCCLI:%.c=%.o) + DEP = depend + +@@ -72,8 +76,8 @@ libx264.a: .depend $(OBJS) $(OBJASM) + ar rc libx264.a $(OBJS) $(OBJASM) + ranlib libx264.a + +-$(SONAME): .depend $(OBJS) $(OBJASM) +- $(CC) -shared -o $@ $(OBJS) $(OBJASM) -Wl,-soname,$(SONAME) $(LDFLAGS) ++$(SONAME): .depend $(SOBJS) $(OBJASM) ++ $(CC) -shared -o $@ $(SOBJS) $(OBJASM) -Wl,-soname,$(SONAME) $(LDFLAGS) + + x264$(EXE): $(OBJCLI) libx264.a + $(CC) -o $@ $+ $(LDFLAGS) +@@ -84,6 +88,9 @@ libx264gtk.a: muxers.o libx264.a + checkasm: tools/checkasm.o libx264.a + $(CC) -o $@ $+ $(LDFLAGS) + ++%.so: %.c ++ $(CC) $(CFLAGS) -fPIC -c -o $@ $< ++ + common/amd64/*.o: common/amd64/amd64inc.asm + common/i386/*.o: common/i386/i386inc.asm + %.o: %.asm +@@ -150,7 +157,6 @@ install: x264 $(SONAME) + install -m 644 x264.pc $(DESTDIR)$(libdir)/pkgconfig + install x264 $(DESTDIR)$(bindir) + ranlib $(DESTDIR)$(libdir)/libx264.a +- $(if $(SONAME), ln -sf $(SONAME) $(DESTDIR)$(libdir)/libx264.so) + $(if $(SONAME), install -m 755 $(SONAME) $(DESTDIR)$(libdir)) + + install-gtk: libx264gtk.a diff --git a/multimedia/x264/patches/patch-common_cpu_c b/multimedia/x264/patches/patch-common_cpu_c new file mode 100644 index 00000000000..ad948e716b3 --- /dev/null +++ b/multimedia/x264/patches/patch-common_cpu_c @@ -0,0 +1,12 @@ +$OpenBSD: patch-common_cpu_c,v 1.1.1.1 2007/04/08 17:31:01 ajacoutot Exp $ +--- common/cpu.c.orig Sun Mar 25 22:45:02 2007 ++++ common/cpu.c Mon Mar 26 17:28:58 2007 +@@ -144,7 +144,7 @@ uint32_t x264_cpu_detect( void ) + return cpu; + } + +-#elif defined( SYS_LINUX ) ++#elif defined SYS_LINUX || defined SYS_OPENBSD + #include + #include + static sigjmp_buf jmpbuf; diff --git a/multimedia/x264/patches/patch-common_ppc_dct_c b/multimedia/x264/patches/patch-common_ppc_dct_c new file mode 100644 index 00000000000..dea9b8ead2e --- /dev/null +++ b/multimedia/x264/patches/patch-common_ppc_dct_c @@ -0,0 +1,12 @@ +$OpenBSD: patch-common_ppc_dct_c,v 1.1.1.1 2007/04/08 17:31:01 ajacoutot Exp $ +--- common/ppc/dct.c.orig Mon Mar 19 22:45:02 2007 ++++ common/ppc/dct.c Tue Mar 20 18:19:50 2007 +@@ -22,7 +22,7 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +-#ifdef SYS_LINUX ++#if defined SYS_LINUX || defined SYS_OPENBSD + #include + #endif + diff --git a/multimedia/x264/patches/patch-common_ppc_mc_c b/multimedia/x264/patches/patch-common_ppc_mc_c new file mode 100644 index 00000000000..363c19fa1e9 --- /dev/null +++ b/multimedia/x264/patches/patch-common_ppc_mc_c @@ -0,0 +1,16 @@ +$OpenBSD: patch-common_ppc_mc_c,v 1.1.1.1 2007/04/08 17:31:01 ajacoutot Exp $ +--- common/ppc/mc.c.orig Mon Mar 19 22:45:02 2007 ++++ common/ppc/mc.c Tue Mar 20 18:20:12 2007 +@@ -24,10 +24,10 @@ + #include + #include + #include +-#include ++#include + #include + +-#ifdef SYS_LINUX ++#if defined SYS_LINUX || defined SYS_OPENBSD + #include + #endif + diff --git a/multimedia/x264/patches/patch-common_ppc_pixel_c b/multimedia/x264/patches/patch-common_ppc_pixel_c new file mode 100644 index 00000000000..3b9da6aeb70 --- /dev/null +++ b/multimedia/x264/patches/patch-common_ppc_pixel_c @@ -0,0 +1,12 @@ +$OpenBSD: patch-common_ppc_pixel_c,v 1.1.1.1 2007/04/08 17:31:01 ajacoutot Exp $ +--- common/ppc/pixel.c.orig Mon Mar 19 22:45:02 2007 ++++ common/ppc/pixel.c Tue Mar 20 18:20:28 2007 +@@ -22,7 +22,7 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +-#ifdef SYS_LINUX ++#if defined SYS_LINUX || defined SYS_OPENBSD + #include + #endif + diff --git a/multimedia/x264/patches/patch-common_ppc_quant_c b/multimedia/x264/patches/patch-common_ppc_quant_c new file mode 100644 index 00000000000..c1148e3b2d9 --- /dev/null +++ b/multimedia/x264/patches/patch-common_ppc_quant_c @@ -0,0 +1,12 @@ +$OpenBSD: patch-common_ppc_quant_c,v 1.1.1.1 2007/04/08 17:31:01 ajacoutot Exp $ +--- common/ppc/quant.c.orig Mon Mar 19 22:45:02 2007 ++++ common/ppc/quant.c Tue Mar 20 18:20:42 2007 +@@ -18,7 +18,7 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +-#if defined SYS_LINUX ++#if defined SYS_LINUX || defined SYS_OPENBSD + #include + #endif + diff --git a/multimedia/x264/patches/patch-configure b/multimedia/x264/patches/patch-configure new file mode 100644 index 00000000000..e3d298270c2 --- /dev/null +++ b/multimedia/x264/patches/patch-configure @@ -0,0 +1,38 @@ +$OpenBSD: patch-configure,v 1.1.1.1 2007/04/08 17:31:01 ajacoutot Exp $ +--- configure.orig Sun Mar 25 22:45:02 2007 ++++ configure Sat Apr 7 07:26:53 2007 +@@ -46,7 +46,7 @@ as_check() { + + rm -f config.h config.mak x264.pc + +-prefix='/usr/local' ++prefix='!!PREFIX!!'; + exec_prefix='${prefix}' + bindir='${exec_prefix}/bin' + libdir='${exec_prefix}/lib' +@@ -375,14 +375,14 @@ if [ "$pic" = "yes" ] ; then + fi + + if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then +- CFLAGS="$CFLAGS -s -fomit-frame-pointer" +- LDFLAGS="$LDFLAGS -s" ++ CFLAGS="$CFLAGS" ++ LDFLAGS="$LDFLAGS" + fi + + if [ "$debug" = "yes" ]; then + CFLAGS="-O1 -g $CFLAGS" + else +- CFLAGS="-O4 -ffast-math $CFLAGS" ++ CFLAGS="-ffast-math $CFLAGS" + fi + + if cc_check "stdio.h" "" "fseeko(stdin,0,0);" ; then +@@ -426,7 +426,6 @@ echo '' >> config.mak + cp config.mak gtk/config.mak + + if [ "$shared" = "yes" ]; then +- API=$(grep '#define X264_BUILD' < x264.h | cut -f 3 -d ' ') + echo "SONAME=libx264.so.$API" >> config.mak + echo 'default: $(SONAME)' >> config.mak + if [ "$gtk" = "yes" ]; then diff --git a/multimedia/x264/pkg/DESCR b/multimedia/x264/pkg/DESCR new file mode 100644 index 00000000000..206f1a76a8a --- /dev/null +++ b/multimedia/x264/pkg/DESCR @@ -0,0 +1,20 @@ +x264 is a free library for encoding H264/AVC video streams. + +This program requires a processor with recent instructions (MMX/SSE for +i386, AltiVec for powerpc). + +Encoder features: + * CAVLC/CABAC + * Multi-references + * Intra: all macroblock types (16x16, 8x8, and 4x4 with all predictions) + * Inter P: all partitions (from 16x16 down to 4x4) + * Inter B: partitions from 16x16 down to 8x8 (including skip/direct) + * Ratecontrol: constant quantizer, single or multipass ABR, optional VBV + * Scene cut detection + * Adaptive B-frame placement + * B-frames as references / arbitrary frame order + * 8x8 and 4x4 adaptive spatial transform + * Lossless mode + * Custom quantization matrices + * Parallel encoding of multiple slices + * Interlacing diff --git a/multimedia/x264/pkg/PFRAG.shared b/multimedia/x264/pkg/PFRAG.shared new file mode 100644 index 00000000000..896d35353c4 --- /dev/null +++ b/multimedia/x264/pkg/PFRAG.shared @@ -0,0 +1,2 @@ +@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2007/04/08 17:31:01 ajacoutot Exp $ +@lib lib/libx264.so.${LIBx264_VERSION} diff --git a/multimedia/x264/pkg/PLIST b/multimedia/x264/pkg/PLIST new file mode 100644 index 00000000000..8e022f0696e --- /dev/null +++ b/multimedia/x264/pkg/PLIST @@ -0,0 +1,7 @@ +@comment $OpenBSD: PLIST,v 1.1.1.1 2007/04/08 17:31:01 ajacoutot Exp $ +%%SHARED%% +bin/x264 +include/x264.h +lib/libx264.a +lib/pkgconfig/ +lib/pkgconfig/x264.pc