From 708b9862103947e687424dce8cbd9fade3e094b6 Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Tue, 20 May 2008 20:15:41 -0600 Subject: [PATCH] fix a crash on win32 with threads. r852 introduced an assumption in deblock that the stack is aligned. --- doc/standards.txt | 10 ++++++++++ encoder/encoder.c | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 doc/standards.txt diff --git a/doc/standards.txt b/doc/standards.txt new file mode 100644 index 00000000..4ebb165a --- /dev/null +++ b/doc/standards.txt @@ -0,0 +1,10 @@ +x264 is written in C. The particular variant of C is: intersection of gcc-2.95 and msvc. This means C89 + a few C99 features. +The extra utilities (mostly checkasm) are written in C99, with no attempt at compatibility with old compilers. + +We make the following additional assumptions which are true of real systems but not guaranteed by C99: +* Two's complement. +* Signed right-shifts are sign-extended. + +x86-specific assumptions: +* The stack is 16-byte aligned. We align it on entry to libx264 and on entry to any thread, but the compiler must preserve alignment after that. +* We call emms before any float operation and before returning from libx264, not after each mmx operation. So bad things could happen if the compiler inserts float operations where they aren't expected. diff --git a/encoder/encoder.c b/encoder/encoder.c index 807d19d9..39c5d5f1 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -1139,6 +1139,8 @@ static void x264_slice_write( x264_t *h ) x264_nal_end( h ); + x264_fdec_filter_row( h, h->sps->i_mb_height ); + /* Compute misc bits */ h->stat.frame.i_misc_bits = bs_pos( &h->out.bs ) + NALU_OVERHEAD * 8 @@ -1185,7 +1187,6 @@ static int x264_slices_write( x264_t *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 ); #if VISUALIZE if( h->param.b_visualize ) -- 2.39.5