fix a crash on win32 with threads.
authorLoren Merritt <pengvado@akuvian.org>
Wed, 21 May 2008 02:15:41 +0000 (20:15 -0600)
committerLoren Merritt <pengvado@akuvian.org>
Wed, 21 May 2008 02:19:28 +0000 (20:19 -0600)
r852 introduced an assumption in deblock that the stack is aligned.

doc/standards.txt [new file with mode: 0644]
encoder/encoder.c

diff --git a/doc/standards.txt b/doc/standards.txt
new file mode 100644 (file)
index 0000000..4ebb165
--- /dev/null
@@ -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.
index 807d19d..39c5d5f 100644 (file)
@@ -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 )