Commit bf06e99e authored by Eric Petit's avatar Eric Petit

Attempt to fix build on Linux PPC


git-svn-id: svn://svn.videolan.org/x264/trunk@14 df754926-b1dd-0310-bc7b-ec298dee348c
parent 86ca4903
...@@ -11,13 +11,13 @@ AS = nasm ; ...@@ -11,13 +11,13 @@ AS = nasm ;
CCFLAGS = -g -Wall -W ; CCFLAGS = -g -Wall -W ;
# Globals defines # Globals defines
DEFINES = DEBUG __X264__ ; DEFINES = DEBUG __X264__ ARCH_$(OSPLAT) SYS_$(OS) ;
# Optims # Optims
OPTIM = -O3 -funroll-loops ; OPTIM = -O3 -funroll-loops ;
# Headers rep # Headers rep
HDRS = . core core/i366 decoder encoder ; HDRS = . core core/i386 decoder encoder ;
SOURCES_C = core/mc.c core/predict.c core/pixel.c core/macroblock.c SOURCES_C = core/mc.c core/predict.c core/pixel.c core/macroblock.c
core/frame.c core/dct.c core/cpu.c core/cabac.c core/frame.c core/dct.c core/cpu.c core/cabac.c
...@@ -33,22 +33,29 @@ SOURCES_ALTIVEC = core/ppc/mc.c core/ppc/pixel.c ; ...@@ -33,22 +33,29 @@ SOURCES_ALTIVEC = core/ppc/mc.c core/ppc/pixel.c ;
# libx264 # libx264
SOURCES_X264 = $(SOURCES_C) ; SOURCES_X264 = $(SOURCES_C) ;
if $(OS) = LINUX if $(OSPLAT) = X86
{ {
DEFINES += ARCH_X86 HAVE_MMXEXT HAVE_SSE2 HAVE_MALLOC_H ; DEFINES += HAVE_MALLOC_H HAVE_MMXEXT HAVE_SSE2 ;
SOURCES_X264 += $(SOURCES_MMX) ; SOURCES_X264 += $(SOURCES_MMX) ;
SOURCES_X264 += $(SOURCES_X86) ; SOURCES_X264 += $(SOURCES_X86) ;
ASFLAGS = -f elf ; ASFLAGS = -f elf ;
# Don't ask why # Don't ask
NOARUPDATE = false ; NOARUPDATE = false ;
} }
if $(OS) = MACOSX if $(OSPLAT) = PPC
{ {
DEFINES += HAVE_ALTIVEC ;
SOURCES_X264 += $(SOURCES_ALTIVEC) ; SOURCES_X264 += $(SOURCES_ALTIVEC) ;
OPTIM += -falign-loops=16 ;
if $(OS) = MACOSX
{
CCFLAGS += -faltivec ; CCFLAGS += -faltivec ;
# OPTIM += -falign-loops=16 ; }
if $(OS) = LINUX
{
CCFLAGS += -maltivec -mabi=altivec ;
}
} }
Library libx264 : $(SOURCES_X264) ; Library libx264 : $(SOURCES_X264) ;
......
# Makefile: tuned for i386/MMX system only # Makefile: tuned for i386/MMX system only
# For ppc append # For ppc append
# SRCS: core/ppc/mc.c core/ppc/pixel.c # SRCS: core/ppc/mc.c core/ppc/pixel.c
# Defines: HAVE_ALTIVEC # Defines: HAVE_PPC
# CFLAGS: -faltivec # CFLAGS: -faltivec
# #
PFLAGS=-DARCH_X86 -DHAVE_MMXEXT -DHAVE_SSE2 PFLAGS=-DARCH_X86 -DHAVE_MMXEXT -DHAVE_SSE2
......
...@@ -194,12 +194,13 @@ uint32_t x264_cpu_detect( void ) ...@@ -194,12 +194,13 @@ uint32_t x264_cpu_detect( void )
} }
#endif #endif
#elif defined( HAVE_ALTIVEC ) #elif defined( ARCH_PPC )
#include <sys/sysctl.h>
#ifdef SYS_MACOSX
#include <sys/sysctl.h>
uint32_t x264_cpu_detect( void ) uint32_t x264_cpu_detect( void )
{ {
/* Thx VLC */ /* Thank you VLC */
uint32_t cpu = 0; uint32_t cpu = 0;
int selectors[2] = { CTL_HW, HW_VECTORUNIT }; int selectors[2] = { CTL_HW, HW_VECTORUNIT };
int has_altivec = 0; int has_altivec = 0;
...@@ -214,6 +215,14 @@ uint32_t x264_cpu_detect( void ) ...@@ -214,6 +215,14 @@ uint32_t x264_cpu_detect( void )
return cpu; return cpu;
} }
#elif defined( SYS_LINUX )
uint32_t x264_cpu_detect( void )
{
/* FIXME (Linux PPC) */
return X264_CPU_ALTIVEC;
}
#endif
void x264_cpu_restore( uint32_t cpu ) void x264_cpu_restore( uint32_t cpu )
{ {
} }
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#ifdef HAVE_MMXEXT #ifdef HAVE_MMXEXT
# include "i386/mc.h" # include "i386/mc.h"
#endif #endif
#ifdef HAVE_ALTIVEC #ifdef ARCH_PPC
# include "ppc/mc.h" # include "ppc/mc.h"
#endif #endif
...@@ -313,7 +313,7 @@ void x264_mc_init( int cpu, x264_mc_function_t pf[2] ) ...@@ -313,7 +313,7 @@ void x264_mc_init( int cpu, x264_mc_function_t pf[2] )
x264_mc_sse2_init( pf ); x264_mc_sse2_init( pf );
#endif #endif
#ifdef HAVE_ALTIVEC #ifdef ARCH_PPC
if( cpu&X264_CPU_ALTIVEC ) if( cpu&X264_CPU_ALTIVEC )
x264_mc_altivec_init( pf ); x264_mc_altivec_init( pf );
#endif #endif
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#ifdef HAVE_MMXEXT #ifdef HAVE_MMXEXT
# include "i386/pixel.h" # include "i386/pixel.h"
#endif #endif
#ifdef HAVE_ALTIVEC #ifdef ARCH_PPC
# include "ppc/pixel.h" # include "ppc/pixel.h"
#endif #endif
...@@ -218,7 +218,7 @@ void x264_pixel_init( int cpu, x264_pixel_function_t *pixf ) ...@@ -218,7 +218,7 @@ void x264_pixel_init( int cpu, x264_pixel_function_t *pixf )
pixf->satd[PIXEL_4x4] = x264_pixel_satd_4x4_mmxext; pixf->satd[PIXEL_4x4] = x264_pixel_satd_4x4_mmxext;
} }
#endif #endif
#ifdef HAVE_ALTIVEC #ifdef ARCH_PPC
if( cpu&X264_CPU_ALTIVEC ) if( cpu&X264_CPU_ALTIVEC )
{ {
x264_pixel_altivec_init( pixf ); x264_pixel_altivec_init( pixf );
......
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#ifdef SYS_LINUX
#include <altivec.h>
#endif
#include "x264.h" #include "x264.h"
#include "../mc.h" #include "../mc.h"
#include "../clip1.h" #include "../clip1.h"
......
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#ifdef SYS_LINUX
#include <altivec.h>
#endif
#include "x264.h" #include "x264.h"
#include "../pixel.h" #include "../pixel.h"
#include "pixel.h" #include "pixel.h"
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "core/i386/dct.h" #include "core/i386/dct.h"
#include "core/i386/mc.h" #include "core/i386/mc.h"
#endif #endif
#ifdef HAVE_ALTIVEC #ifdef ARCH_PPC
#include "core/ppc/pixel.h" #include "core/ppc/pixel.h"
#endif #endif
...@@ -30,7 +30,7 @@ static int check_pixel() ...@@ -30,7 +30,7 @@ static int check_pixel()
#ifdef HAVE_MMXEXT #ifdef HAVE_MMXEXT
x264_pixel_init( X264_CPU_MMX|X264_CPU_MMXEXT, &pixel_asm ); x264_pixel_init( X264_CPU_MMX|X264_CPU_MMXEXT, &pixel_asm );
#endif #endif
#ifdef HAVE_ALTIVEC #ifdef ARCH_PPC
x264_pixel_altivec_init( &pixel_asm ); x264_pixel_altivec_init( &pixel_asm );
#endif #endif
...@@ -311,7 +311,7 @@ int main() ...@@ -311,7 +311,7 @@ int main()
#ifdef HAVE_MMXEXT #ifdef HAVE_MMXEXT
fprintf( stderr, "x264: MMXEXT against C\n" ); fprintf( stderr, "x264: MMXEXT against C\n" );
#elif HAVE_ALTIVEC #elif ARCH_PPC
fprintf( stderr, "x264: ALTIVEC against C\n" ); fprintf( stderr, "x264: ALTIVEC against C\n" );
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment