x264 patch
Tomasz Sowa
t.sowa at ttmath.org
Thu Dec 17 17:58:37 UTC 2009
Hello
x264 from git doesn't want to compile on FreeBSD.
I have added one option to configure: --disable-asm-ssse3 this disables
only ssse3 extension (you still have the rest asm code). If you want
this extension you should have a minimum binutils 2.17.
log2f() function I changed to: (log(i+1)/M_LN2), and a path to bash
I changed to /usr/local/bin/bash.
$ git clone git://git.videolan.org/x264.git
$ cp x264.bsd.path x264/
$ cd x264
$ patch -p1 < x264.bsd.path
$ ./configure --disable-asm-ssse3 --enable-shared --enable-pic
$ gmake
# gmake install
$ x264 --version
x264 0.80.1376M 3feaec2
built on Dec 17 2009, gcc: 4.2.1 20070719 [FreeBSD]
Some proposal: what about creating a new port: multimedia/x264-devel ?
Link to patch: http://slimaczek.pl/tmp/x264.bsd.path
--
diff --git a/common/x86/predict-c.c b/common/x86/predict-c.c
index 602ddcd..4b2dd2d 100644
--- a/common/x86/predict-c.c
+++ b/common/x86/predict-c.c
@@ -110,6 +110,7 @@ PREDICT_16x16_P( mmxext )
#endif
PREDICT_16x16_P( sse2 )
+#ifndef DISABLE_ASM_SSSE3
#ifdef __GNUC__
static void predict_16x16_p_ssse3( uint8_t *src )
{
@@ -146,6 +147,7 @@ static void predict_16x16_p_ssse3( uint8_t *src )
predict_16x16_p_core_sse2( src, i00, b, c );
}
#endif
+#endif
#define PREDICT_8x8_P(name)\
static void predict_8x8c_p_##name( uint8_t *src )\
@@ -170,6 +172,7 @@ PREDICT_8x8_P( mmxext )
#endif
PREDICT_8x8_P( sse2 )
+#ifndef DISABLE_ASM_SSSE3
#ifdef __GNUC__
static void predict_8x8c_p_ssse3( uint8_t *src )
{
@@ -199,6 +202,7 @@ static void predict_8x8c_p_ssse3( uint8_t *src )
predict_8x8c_p_core_sse2( src, i00, b, c );
}
#endif
+#endif
#define PREDICT_16x16_DC(name)\
static void predict_16x16_dc_##name( uint8_t *src )\
@@ -394,9 +398,11 @@ void x264_predict_16x16_init_mmx( int cpu, x264_predict_t pf[7] )
if( !(cpu&X264_CPU_SSSE3) )
return;
pf[I_PRED_16x16_H] = predict_16x16_h_ssse3;
+#ifndef DISABLE_ASM_SSSE3
#ifdef __GNUC__
pf[I_PRED_16x16_P] = predict_16x16_p_ssse3;
#endif
+#endif
}
void x264_predict_8x8c_init_mmx( int cpu, x264_predict_t pf[7] )
@@ -421,9 +427,11 @@ void x264_predict_8x8c_init_mmx( int cpu, x264_predict_t pf[7] )
if( !(cpu&X264_CPU_SSSE3) )
return;
pf[I_PRED_CHROMA_H] = predict_8x8c_h_ssse3;
+#ifndef DISABLE_ASM_SSSE3
#ifdef __GNUC__
pf[I_PRED_CHROMA_P] = predict_8x8c_p_ssse3;
#endif
+#endif
}
void x264_predict_8x8_init_mmx( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_8x8_filter )
diff --git a/configure b/configure
index 0cc246d..e5d6696 100755
--- a/configure
+++ b/configure
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/local/bin/bash
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
@@ -10,6 +10,7 @@ echo " --help print this message"
echo " --disable-avs-input disables avisynth input (win32 only)"
echo " --disable-mp4-output disables mp4 output (using gpac)"
echo " --disable-pthread disables multithreaded encoding"
+echo " --disable-asm-ssse3 disables SSSE3 (SSE3 extension) on x86"
echo " --disable-asm disables assembly optimizations on x86 and arm"
echo " --enable-debug adds -g, doesn't strip"
echo " --enable-gprof adds -pg, doesn't strip"
@@ -68,6 +69,7 @@ HAVE_GETOPT_LONG=1
cross_prefix=""
EXE=""
+DISABLE_ASM_SSSE3="no"
# parse options
@@ -89,6 +91,10 @@ for opt do
--includedir=*)
includedir="$optarg"
;;
+ --disable-asm-ssse3)
+ CFLAGS="$CFLAGS -DDISABLE_ASM_SSSE3"
+ DISABLE_ASM_SSSE3="yes"
+ ;;
--enable-asm)
asm="yes"
;;
@@ -324,14 +330,14 @@ if [ $asm = yes -a \( $ARCH = X86 -o $ARCH = X86_64 \) ] ; then
echo "If you really want to compile without asm, configure with --disable-asm."
exit 1
fi
- if ! cc_check '' '' 'asm("pabsw %xmm0, %xmm0");' ; then
- VER=`(as --version || echo no gnu as) 2>$DEVNULL | head -n 1`
- echo "Found $VER"
- echo "Minimum version is binutils-2.17"
- echo "Your compiler can't handle inline SSSE3 asm."
- echo "If you really want to compile without asm, configure with --disable-asm."
- exit 1
- fi
+# if ! cc_check '' '' 'asm("pabsw %xmm0, %xmm0");' ; then
+# VER=`(as --version || echo no gnu as) 2>$DEVNULL | head -n 1`
+# echo "Found $VER"
+# echo "Minimum version is binutils-2.17"
+# echo "Your compiler can't handle inline SSSE3 asm."
+# echo "If you really want to compile without asm, configure with --disable-asm."
+# exit 1
+# fi
CFLAGS="$CFLAGS -DHAVE_MMX"
fi
diff --git a/encoder/analyse.c b/encoder/analyse.c
index f6066d9..25407f7 100644
--- a/encoder/analyse.c
+++ b/encoder/analyse.c
@@ -250,7 +250,7 @@ int x264_analyse_init_costs( x264_t *h, int qp )
for( i = 0; i <= 2*4*2048; i++ )
{
h->cost_mv[lambda][-i] =
- h->cost_mv[lambda][i] = lambda * (log2f(i+1)*2 + 0.718f + !!i) + .5f;
+ h->cost_mv[lambda][i] = lambda * ((log(i+1)/M_LN2)*2 + 0.718f + !!i) + .5f;
}
x264_pthread_mutex_lock( &cost_ref_mutex );
for( i = 0; i < 3; i++ )
diff --git a/version.sh b/version.sh
index c877847..85ee023 100755
--- a/version.sh
+++ b/version.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/local/bin/bash
git rev-list HEAD | sort > config.git-hash
LOCALVER=`wc -l config.git-hash | awk '{print $1}'`
if [ $LOCALVER \> 1 ] ; then
More information about the freebsd-multimedia
mailing list