[x264-devel] commit: fix a crash on win32 with threads. (Loren Merritt )

git version control git at videolan.org
Wed May 21 04:21:23 CEST 2008


x264 | branch: master | Loren Merritt <pengvado at akuvian.org> | Tue May 20 20:15:41 2008 -0600| [ce13bb6e8108657599433031df9c260c9f81b49d]

fix a crash on win32 with threads.
r852 introduced an assumption in deblock that the stack is aligned.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=ce13bb6e8108657599433031df9c260c9f81b49d
---

 doc/standards.txt |   10 ++++++++++
 encoder/encoder.c |    3 ++-
 2 files changed, 12 insertions(+), 1 deletions(-)

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



More information about the x264-devel mailing list