this crash was introduced in r642, but only because previous versions didn't use sse2 on the stack.
git-svn-id: svn://svn.videolan.org/x264/trunk@646
df754926-b1dd-0310-bc7b-
ec298dee348c
/* probably MMX(EXT) centric but .... */
void x264_cpu_restore( uint32_t cpu );
+/* kluge:
+ * gcc can't give variables any greater alignment than the stack frame has.
+ * We need 16 byte alignment for SSE2, so here we make sure that the stack is
+ * aligned to 16 bytes.
+ * gcc 4.2 introduced __attribute__((force_align_arg_pointer)) to fix this
+ * problem, but I don't want to require such a new version.
+ * This applies only to x86_32, since other architectures that need alignment
+ * also have ABIs that ensure aligned stack. */
+#ifdef ARCH_X86
+void x264_stack_align( void (*func)(x264_t*), x264_t *arg );
+#else
+#define x264_stack_align(func,arg) func(arg)
+#endif
+
#endif
emms
ret
+;-----------------------------------------------------------------------------
+; void x264_stack_align( void (*func)(void*), void *arg );
+;-----------------------------------------------------------------------------
+cglobal x264_stack_align
+ push ebp
+ mov ebp, esp
+ sub esp, 4
+ and esp, ~15
+ mov ecx, [ebp+8]
+ mov edx, [ebp+12]
+ mov [esp], edx
+ call ecx
+ mov esp, ebp
+ pop ebp
+ ret
+
x264_macroblock_slice_init( h );
}
-static int x264_slice_write( x264_t *h )
+static void x264_slice_write( x264_t *h )
{
int i_skip;
int mb_xy;
- h->stat.frame.i_itex_bits
- h->stat.frame.i_ptex_bits
- h->stat.frame.i_hdr_bits;
-
- return 0;
}
static void x264_thread_sync_context( x264_t *dst, x264_t *src )
x264_visualize_init( h );
#endif
- x264_slice_write( h );
+ x264_stack_align( x264_slice_write, h );
i_frame_size = h->out.nal[h->out.i_nal-1].i_payload;
x264_fdec_filter_row( h, h->sps->i_mb_height );