r1413 caused crashes on any system with malloc.h.
Also switch to std=c99 or std=gnu99 if supported by the compiler.
Fix visualize support.
-@ $(STRIP) -x $@ # delete local/anonymous symbols, so they don't show up in oprofile
.depend: config.mak
- rm -f .depend
- $(foreach SRC, $(SRCS) $(SRCCLI) $(SRCSO), $(CC) $(CFLAGS) $(ALTIVECFLAGS) $(SRC) -MT $(SRC:%.c=%.o) -MM -g0 1>> .depend;)
+ @rm -f .depend
+ @$(foreach SRC, $(SRCS) $(SRCCLI) $(SRCSO), $(CC) $(CFLAGS) $(SRC) -MT $(SRC:%.c=%.o) -MM -g0 1>> .depend;)
config.mak:
./configure
- sed -e 's/ *-fprofile-\(generate\|use\)//g' config.mak > config.mak2 && mv config.mak2 config.mak
distclean: clean
- rm -f config.mak config.h x264.pc
+ rm -f config.mak config.h config.log x264.pc
rm -rf test/
install: x264$(EXE) $(SONAME)
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
*****************************************************************************/
+#include "common.h"
+#include "cpu.h"
+
#include <stdarg.h>
#include <ctype.h>
#include <malloc.h>
#endif
-#include "common.h"
-#include "cpu.h"
-
static void x264_log_default( void *, int, const char *, va_list );
/****************************************************************************
if( b_error )
{
char *buf = strdup(value);
- char *tok, UNUSED *saveptr, *init;
+ char *tok, UNUSED *saveptr=NULL, *init;
b_error = 0;
p->cpu = 0;
for( init=buf; (tok=strtok_r(init, ",", &saveptr)); init=NULL )
}
OPT("log")
p->i_log_level = atoi(value);
-#ifdef VISUALIZE
+#ifdef HAVE_VISUALIZE
OPT("visualize")
p->b_visualize = atobool(value);
#endif
x264_quant_function_t quantf;
x264_deblock_function_t loopf;
-#if VISUALIZE
+#ifdef HAVE_VISUALIZE
struct visualize_t *visualize;
#endif
x264_lookahead_t *lookahead;
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
*****************************************************************************/
+#define _GNU_SOURCE // for sched_getaffinity
+#include "common.h"
+#include "cpu.h"
+
#if defined(HAVE_PTHREAD) && defined(SYS_LINUX)
-#define _GNU_SOURCE
#include <sched.h>
#endif
#ifdef SYS_BEOS
#include <machine/cpu.h>
#endif
-#include "common.h"
-#include "cpu.h"
-
const x264_cpu_name_t x264_cpu_names[] = {
{"Altivec", X264_CPU_ALTIVEC},
// {"MMX", X264_CPU_MMX}, // we don't support asm on mmx1 cpus anymore
#define WORD_SIZE sizeof(void*)
+#define asm __asm__
+
#if !defined(_WIN64) && !defined(__LP64__)
#if defined(__INTEL_COMPILER)
#define BROKEN_STACK_ALIGNMENT /* define it if stack is not mod16 */
cc_check() {
if [ -z "$3" ]; then
- if [ -z "$1" ]; then
+ if [ -z "$1$2" ]; then
log_check "whether $CC works"
+ elif [ -z "$1" ]; then
+ log_check "for $2"
else
log_check "for $1"
fi
elif [ -z "$1" ]; then
log_check "whether $CC supports $3"
else
- log_check "for $3 on $1";
+ log_check "for $3 in $1";
fi
rm -f conftest.c
[ -n "$1" ] && echo "#include <$1>" > conftest.c
;;
--enable-visualize)
LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
- define VISUALIZE
+ define HAVE_VISUALIZE
vis="yes"
;;
--host=*)
cc_check || die "No working C compiler found."
+if cc_check '' -std=gnu99 ; then
+ CFLAGS="$CFLAGS -std=gnu99"
+elif cc_check '' -std=c99 ; then
+ CFLAGS="$CFLAGS -std=c99 -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE"
+fi
+
if [ $shared = yes -a \( $ARCH = "X86_64" -o $ARCH = "PPC" -o $ARCH = "ALPHA" -o $ARCH = "ARM" \) ] ; then
pic="yes"
fi
echo "If you really want to compile without asm, configure with --disable-asm."
exit 1
fi
- if ! cc_check '' '' 'asm("pabsw %xmm0, %xmm0");' ; then
+ 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"
# set flags so neon is built by default
echo $CFLAGS | grep -Eq '(-mcpu|-march|-mfpu|-mfloat-abi)' || CFLAGS="$CFLAGS -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp"
- if cc_check '' '' 'asm("rev ip, ip");' ; then define HAVE_ARMV6 && ASFLAGS="$ASFLAGS -DHAVE_ARMV6"
- cc_check '' '' 'asm("movt r0, #0");' && define HAVE_ARMV6T2 && ASFLAGS="$ASFLAGS -DHAVE_ARMV6T2"
- cc_check '' '' 'asm("vadd.i16 q0, q0, q0");' && define HAVE_NEON && ASFLAGS="$ASFLAGS -DHAVE_NEON"
+ if cc_check '' '' '__asm__("rev ip, ip");' ; then define HAVE_ARMV6 && ASFLAGS="$ASFLAGS -DHAVE_ARMV6"
+ cc_check '' '' '__asm__("movt r0, #0");' && define HAVE_ARMV6T2 && ASFLAGS="$ASFLAGS -DHAVE_ARMV6T2"
+ cc_check '' '' '__asm__("vadd.i16 q0, q0, q0");' && define HAVE_NEON && ASFLAGS="$ASFLAGS -DHAVE_NEON"
ASFLAGS="$ASFLAGS -c"
else
echo "You specified a pre-ARMv6 or Thumb-1 CPU in your CFLAGS."
#include "macroblock.h"
#include "me.h"
-#if VISUALIZE
+#ifdef HAVE_VISUALIZE
#include "common/visualize.h"
#endif
else
h->mb.b_reencode_mb = 0;
-#if VISUALIZE
+#ifdef HAVE_VISUALIZE
if( h->param.b_visualize )
x264_visualize_mb( h );
#endif
x264_cpu_mask_misalign_sse();
#endif
-#if VISUALIZE
+#ifdef HAVE_VISUALIZE
if( h->param.b_visualize )
if( x264_visualize_init( h ) )
return (void *)-1;
h->sh.i_first_mb = h->sh.i_last_mb + 1;
}
-#if VISUALIZE
+#ifdef HAVE_VISUALIZE
if( h->param.b_visualize )
{
x264_visualize_show( h );
static int parse_zone( x264_t *h, x264_zone_t *z, char *p )
{
int len = 0;
- char *tok, UNUSED *saveptr;
+ char *tok, UNUSED *saveptr=NULL;
z->param = NULL;
z->f_bitrate_factor = 1;
if( 3 <= sscanf(p, "%u,%u,q=%u%n", &z->i_start, &z->i_end, &z->i_qp, &len) )
if( prev_cts == cts )
{
double fps = ((double)p_flv->i_timebase_den / p_flv->i_timebase_num) / (p_picture->i_pts - p_flv->i_prev_pts);
- fprintf( stderr, "flv [warning]: duplicate CTS %"PRId64" is generated by rounding\n"
+ fprintf( stderr, "flv [warning]: duplicate CTS %"PRId64" generated by rounding\n"
" current internal composition framerate: %.6f fps\n", cts, fps );
}
}