Commit 851989ac authored by Eric Petit's avatar Eric Petit

+ No need to emulate memalign on OS X

 + Fixed Makefile for OS X

 (Original patch by Peter Handel)


git-svn-id: svn://svn.videolan.org/x264/trunk@55 df754926-b1dd-0310-bc7b-ec298dee348c
parent 57554925
# Makefile: tuned for i386/MMX system only
# For ppc append
# SRCS: core/ppc/mc.c core/ppc/pixel.c
# Defines: HAVE_PPC
# CFLAGS: -faltivec
# For FreeBSD, remove -DHAVE_MALLOC_H and add -DSYS_FREEBSD
#
PFLAGS=-DARCH_X86 -DHAVE_MMXEXT -DHAVE_SSE2
CC=gcc
CFLAGS=-g -Wall -I. -DDEBUG -O4 -funroll-loops -D__X264__ -DHAVE_MALLOC_H $(PFLAGS)
SRCS= 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/common.c core/mdate.c core/csp.c \
encoder/analyse.c encoder/me.c encoder/ratecontrol.c \
encoder/set.c encoder/macroblock.c encoder/cabac.c encoder/cavlc.c \
encoder/encoder.c encoder/eval.c \
core/i386/mc-c.c core/i386/dct-c.c core/i386/predict.c \
x264.c
# Uncomment this for Mac OS X
#SYS_MACOSX=1
SRCS_COMMON= 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/common.c core/mdate.c core/csp.c \
encoder/analyse.c encoder/me.c encoder/ratecontrol.c \
encoder/set.c encoder/macroblock.c encoder/cabac.c \
encoder/cavlc.c encoder/encoder.c encoder/eval.c x264.c
ifdef SYS_MACOSX
PFLAGS=-DARCH_PPC -DSYS_MACOSX -faltivec
SRCS= $(SRCS_COMMON) core/ppc/mc.c core/ppc/pixel.c
else
PFLAGS=-DARCH_X86 -DHAVE_MMXEXT -DHAVE_SSE2 -DHAVE_MALLOC_H
SRCS= $(SRCS_COMMON) core/i386/mc-c.c core/i386/dct-c.c core/i386/predict.c
ASMSRC= core/i386/dct.asm core/i386/cpu.asm core/i386/pixel.asm core/i386/mc.asm
OBJASM= $(ASMSRC:%.asm=%.o)
endif
CC=gcc
CFLAGS=-g -Wall -I. -DDEBUG -O4 -funroll-loops -D__X264__ $(PFLAGS)
AS= nasm
# for linux
......@@ -24,9 +31,6 @@ ASFLAGS=-f elf $(PFLAGS)
# for cygwin
#ASFLAGS=-f gnuwin32 -DPREFIX
ASMSRC= core/i386/dct.asm core/i386/cpu.asm core/i386/pixel.asm core/i386/mc.asm
OBJASM= $(ASMSRC:%.asm=%.o)
OBJS = $(SRCS:%.c=%.o)
DEP = depend
......@@ -34,6 +38,7 @@ default: $(DEP) x264
libx264.a: $(OBJS) $(OBJASM)
ar rc libx264.a $(OBJS) $(OBJASM)
ranlib libx264.a
x264: libx264.a x264.o
$(CC) $(CFLAGS) -o x264 x264.o libx264.a -lm
......
......@@ -303,7 +303,10 @@ int x264_nal_decode( x264_nal_t *nal, void *p_data, int i_data )
****************************************************************************/
void *x264_malloc( int i_size )
{
#ifdef HAVE_MALLOC_H
#ifdef SYS_MACOSX
/* Mac OS X always returns 16 bytes aligned memory */
return malloc( i_size );
#elif defined( HAVE_MALLOC_H )
return memalign( 16, i_size );
#else
uint8_t * buf;
......@@ -325,7 +328,7 @@ void x264_free( void *p )
{
if( p )
{
#ifdef HAVE_MALLOC_H
#if defined( HAVE_MALLOC_H ) || defined( SYS_MACOSX )
free( p );
#else
free( *( ( ( void **) p ) - 1 ) );
......
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