Commit 30b14a48 authored by Fiona Glaser's avatar Fiona Glaser

Add stack alignment for lookahead functions

Should allow libx264 to be called from non-gcc-compiled applications without adding force_align_arg_pointer.
parent cb688111
......@@ -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
......
......@@ -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 ) )
......
......@@ -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;
......
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