From: Jason Garrett-Glaser Date: Wed, 31 Dec 2008 03:14:45 +0000 (-0500) Subject: Add stack alignment for lookahead functions X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=390d26ad2ca72b420448c36a747d3ee49b79e75b;p=x264.git Add stack alignment for lookahead functions Should allow libx264 to be called from non-gcc-compiled applications without adding force_align_arg_pointer. --- diff --git a/common/cpu.h b/common/cpu.h index b004023a..4380a359 100644 --- a/common/cpu.h +++ b/common/cpu.h @@ -35,7 +35,8 @@ void x264_cpu_mask_misalign_sse( void ); * This applies only to x86_32, since other architectures that need alignment * also have ABIs that ensure aligned stack. */ #if defined(ARCH_X86) && defined(HAVE_MMX) -void x264_stack_align( void (*func)(x264_t*), x264_t *arg ); +int x264_stack_align( void (*func)(x264_t*), x264_t *arg ); +#define x264_stack_align(func,arg) x264_stack_align((void (*)(x264_t*))func,arg) #else #define x264_stack_align(func,arg) func(arg) #endif diff --git a/encoder/encoder.c b/encoder/encoder.c index 5ecab7e8..fd86a18d 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -1436,7 +1436,7 @@ int x264_encoder_encode( x264_t *h, return 0; } - x264_slicetype_decide( h ); + x264_stack_align( x264_slicetype_decide, h ); /* 3: move some B-frames and 1 non-B to encode queue */ while( IS_X264_TYPE_B( h->frames.next[bframes]->i_type ) ) diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index 5a74172f..2b876d3a 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -1507,7 +1507,7 @@ static float rate_estimate_qscale( x264_t *h ) expected_size = qscale2bits(&rce, q); expected_vbv = rcc->buffer_fill + rcc->buffer_rate - expected_size; } - rcc->last_satd = x264_rc_analyse_slice( h ); + rcc->last_satd = x264_stack_align( x264_rc_analyse_slice, h ); } q = x264_clip3f( q, lmin, lmax ); } @@ -1525,7 +1525,7 @@ static float rate_estimate_qscale( x264_t *h ) double wanted_bits, overflow=1, lmin, lmax; - rcc->last_satd = x264_rc_analyse_slice( h ); + rcc->last_satd = x264_stack_align( x264_rc_analyse_slice, h ); rcc->short_term_cplxsum *= 0.5; rcc->short_term_cplxcount *= 0.5; rcc->short_term_cplxsum += rcc->last_satd;