Date: Wed, 25 Feb 2009 10:45:47 -0300 From: Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> To: multimedia@FreeBSD.org Subject: multimedia/x264: Adding Profile-Guided Optimization to OPTIONS Message-ID: <20090225134547.45467.qmail@exxodus.fedaykin.here>
next in thread | raw e-mail | index | archive | help
--gKMricLos+KVdGMg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, What about our adding Profile-Guided Optimization to OPTIONS? I am still not sure about the performance gains since I do not usually benchmark x264. This would be a default "Off" option at 1st since: 1) I am not certain it really provides gains (I am not a x264 power user) 2) I am not certain gcc does not botch the optimized code 3) I am not sure the user will be using gcc (although I am not sure this ports would work with icc or a variant) A lot of cons but we have a pro: giving our users the option. Furthermore, it does not seem to botch the simple videos I have here for testing. Well, after your consideration, I would propose circulating this on the -ports mailing list to gather some evidence on performance. The patch against multimedia/x264 is attached. I am downloading a sample.y4m file from mplayerhq which I am not sure is really free. Therefore, the usual no-redistribution variables could be in order when WITH_PGO is enabled. Nevertheless, we do not need those for internal peer review. The 1st concrete difference I noticed is the file size. It is dramatically smaller WITH_PGO enabled. $ tar -tvjf x264-0.0.20080409_2-PGO.tbz -rw-r--r-- 0 root wheel 2148 25 Fev 10:29 +CONTENTS -rw-r--r-- 0 root wheel 65 25 Fev 10:29 +COMMENT -rw-r--r-- 0 root wheel 448 25 Fev 10:29 +DESC -rw-r--r-- 0 root wheel 17501 25 Fev 10:29 +MTREE_DIRS -rwxr-xr-x 0 root wheel 557412 25 Fev 10:29 bin/x264 -rw-r--r-- 0 root wheel 17441 25 Fev 10:29 include/x264.h -rw-r--r-- 0 root wheel 662824 25 Fev 10:29 lib/libx264.a lrwxr-xr-x 0 root wheel 0 25 Fev 10:29 lib/libx264.so -> libx264.so.50 -rwxr-xr-x 0 root wheel 537636 25 Fev 10:29 lib/libx264.so.50 -rw-r--r-- 0 root wheel 241 25 Fev 10:29 libdata/pkgconfig/x264.pc $ tar -tvjf x264-0.0.20080409_2.tbz -rw-r--r-- 0 root wheel 2148 25 Fev 10:27 +CONTENTS -rw-r--r-- 0 root wheel 65 25 Fev 10:27 +COMMENT -rw-r--r-- 0 root wheel 448 25 Fev 10:27 +DESC -rw-r--r-- 0 root wheel 17501 25 Fev 10:27 +MTREE_DIRS -rwxr-xr-x 0 root wheel 784612 25 Fev 10:27 bin/x264 -rw-r--r-- 0 root wheel 17441 25 Fev 10:27 include/x264.h -rw-r--r-- 0 root wheel 897432 25 Fev 10:27 lib/libx264.a lrwxr-xr-x 0 root wheel 0 25 Fev 10:27 lib/libx264.so -> libx264.so.50 -rwxr-xr-x 0 root wheel 759940 25 Fev 10:27 lib/libx264.so.50 -rw-r--r-- 0 root wheel 241 25 Fev 10:27 libdata/pkgconfig/x264.pc ps: In case, you're wondering. I am pushing PGO so that we gather some notice on some of the players that could really benefit from it -> firefox/openoffice/mplayer/ffmpeg. Benchmarks pending to make sure it is beneficial though. Regards, -- Mario S F Ferreira - DF - Brazil - "I guess this is a signature." feature, n: a documented bug | bug, n: an undocumented feature --gKMricLos+KVdGMg Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename=patch Index: Makefile =================================================================== RCS file: /home/pcvs/ports/multimedia/x264/Makefile,v retrieving revision 1.63 diff -d -u -u -r1.63 Makefile --- Makefile 6 Jun 2008 14:33:38 -0000 1.63 +++ Makefile 25 Feb 2009 13:31:44 -0000 @@ -9,8 +9,10 @@ PORTVERSION= 0.0.20080409 PORTREVISION?= 2 CATEGORIES= multimedia -MASTER_SITES= http://downloads.videolan.org/pub/videolan/x264/snapshots/ +MASTER_SITES= http://downloads.videolan.org/pub/videolan/x264/snapshots/ \ + http://samples.mplayerhq.hu/yuv4mpeg2/:pgo DISTNAME= ${PORTNAME}-snapshot-${PORTVERSION:S/0.0.//}-2245 +EXTRACT_ONLY= ${PORTNAME}-snapshot-${PORTVERSION:S/0.0.//}-2245${EXTRACT_SUFX} MAINTAINER= multimedia@FreeBSD.org COMMENT?= Multimedia library and tool for encoding H.264/AVC video streams @@ -27,7 +29,8 @@ HAS_CONFIGURE= yes OPTIONS= DEBUG "Enable Debugging" Off \ - OPTIMIZED_CFLAGS "Enable Optimized CFLAGS" Off + OPTIMIZED_CFLAGS "Enable Optimized CFLAGS" Off \ + PGO "Enable Profile-Guided Optimization" Off CONFIGURE_ARGS+= --extra-cflags="${CPPFLAGS} ${CFLAGS} -fPIC -I${LOCALBASE}/include -I${LOCALBASE}/include" \ --extra-ldflags="${LDFLAGS} -L${LOCALBASE}/lib -L${LOCALBASE}/lib" \ @@ -35,6 +38,9 @@ .include <bsd.port.pre.mk> +# y4m sample video +Y4M_VIDEO=example.y4m + .if defined(WITH_GTK2) && ${SLAVE_PORT:L}=="yes" LIB_DEPENDS+= x264.50:${PORTSDIR}/multimedia/x264 BUILD_WRKSRC= ${WRKSRC}/gtk @@ -58,6 +64,11 @@ CONFIGURE_ARGS+= --enable-debug .endif +.if defined(WITH_PGO) && ${SLAVE_PORT:L}!="yes" +DISTFILES+= ${Y4M_VIDEO}.bz2:pgo +ALL_TARGET= fprofiled VIDS="${WRKDIR}/${Y4M_VIDEO}" +.endif + .if defined(WITH_OPTIMIZED_CFLAGS) CFLAGS+= -O2 -funroll-loops -ffast-math .endif @@ -73,6 +84,11 @@ USE_XORG= x11 .endif +post-extract: +.if defined(WITH_PGO) && ${SLAVE_PORT:L}!="yes" + @( cd ${WRKDIR} && ${BZIP2_CMD} -dc ${DISTDIR}/${Y4M_VIDEO}.bz2 > ${Y4M_VIDEO} ) +.endif + post-patch: @${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|; \ s|-lpthread|${PTHREAD_LIBS}|g' \ Index: distinfo =================================================================== RCS file: /home/pcvs/ports/multimedia/x264/distinfo,v retrieving revision 1.34 diff -d -u -u -r1.34 distinfo --- distinfo 10 Apr 2008 01:01:26 -0000 1.34 +++ distinfo 25 Feb 2009 13:31:44 -0000 @@ -1,3 +1,3 @@ -MD5 (x264-snapshot-20080409-2245.tar.bz2) = 2a1b0ad913885cfde72159671ad51280 -SHA256 (x264-snapshot-20080409-2245.tar.bz2) = 6a921b0fc21cf508fd4df003b400903dee50cc046e3d4a8570aef34f4a000b32 -SIZE (x264-snapshot-20080409-2245.tar.bz2) = 1919929 +MD5 (example.y4m.bz2) = e0948016cd4a52e75d6a74d998bd6ae6 +SHA256 (example.y4m.bz2) = a5bec9d37362bd9d7773fbd0644643f9ec096d654d20823004e88d5df32bbff7 +SIZE (example.y4m.bz2) = 4910029 --gKMricLos+KVdGMg--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090225134547.45467.qmail>