[x264-devel] commit: Attempt to detect miscompilation due to bug in gcc 4.2 ( Jason Garrett-Glaser )

git version control git at videolan.org
Wed Sep 23 11:01:53 CEST 2009


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Tue Sep 22 17:30:19 2009 -0700| [e4d977cc9fb1975b855f27185f74c3705d42f9f6] | committer: Jason Garrett-Glaser 

Attempt to detect miscompilation due to bug in gcc 4.2
I don't know if this bug still affects latest x264, but it can't hurt to try to detect it.
Accordingly refuse to open the encoder if detected.
Apparently VLC has been distributed for quite some time with a completely
broken x264 due to the use of a completely broken compiler (gcc 4.2).  In
particular, the MV costs seem to be calculated incorrectly on win32 when linking
from an application compiled without -ffast-math to an application with
-ffast-math.
I am not entirely certain why this occurs, but the result is, unsurprisingly,
encoding quality that makes MPEG-2 look good, due to the motion search being
completely broken.

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

 encoder/encoder.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/encoder/encoder.c b/encoder/encoder.c
index 207e724..1b0cd03 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -873,6 +873,11 @@ x264_t *x264_encoder_open( x264_param_t *param )
             goto fail;
     if( x264_analyse_init_costs( h, X264_LOOKAHEAD_QP ) )
         goto fail;
+    if( h->cost_mv[1][2013] != 24 )
+    {
+        x264_log( h, X264_LOG_ERROR, "MV cost test failed: x264 has been miscompiled!\n" );
+        goto fail;
+    }
 
     h->out.i_nal = 0;
     h->out.i_bitstream = X264_MAX( 1000000, h->param.i_width * h->param.i_height * 4



More information about the x264-devel mailing list