[x264-devel] commit: Fix miscompilation with gcc 4.3 on ARM (Jason Garrett-Glaser )

git version control git at videolan.org
Mon Nov 9 05:22:03 CET 2009


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Wed Nov  4 00:03:14 2009 -0800| [820380f981da35ae4f8fc124cb8b5ee1c4cbad4b] | committer: Jason Garrett-Glaser 

Fix miscompilation with gcc 4.3 on ARM
Aliasing violation in spatial prediction caused nasty artifacts.
Shut up two other GCC warnings while we're at it.

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

 common/macroblock.c |   10 ++++++++--
 encoder/analyse.c   |    4 ++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/common/macroblock.c b/common/macroblock.c
index 56e771f..fe4aa0e 100644
--- a/common/macroblock.c
+++ b/common/macroblock.c
@@ -259,11 +259,17 @@ static int x264_mb_predict_mv_direct16x16_spatial( x264_t *h )
     if( ref[0] >= 0 )
         x264_mb_predict_mv_16x16( h, 0, ref[0], mv[0] );
     else
-        *(uint32_t*)mv[0] = 0;
+    {
+        mv[0][0] = 0;
+        mv[0][1] = 0;
+    }
     if( ref[1] >= 0 )
         x264_mb_predict_mv_16x16( h, 1, ref[1], mv[1] );
     else
-        *(uint32_t*)mv[1] = 0;
+    {
+        mv[1][0] = 0;
+        mv[1][1] = 0;
+    }
 
     x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, ref[0] );
     x264_macroblock_cache_ref( h, 0, 0, 4, 4, 1, ref[1] );
diff --git a/encoder/analyse.c b/encoder/analyse.c
index 51dd227..26e68e1 100644
--- a/encoder/analyse.c
+++ b/encoder/analyse.c
@@ -236,7 +236,7 @@ static const int i_sub_mb_p_cost_table[4] = {
 static void x264_analyse_update_cache( x264_t *h, x264_mb_analysis_t *a );
 
 static uint16_t x264_cost_ref[92][3][33];
-static x264_pthread_mutex_t cost_ref_mutex = X264_PTHREAD_MUTEX_INITIALIZER;
+static UNUSED x264_pthread_mutex_t cost_ref_mutex = X264_PTHREAD_MUTEX_INITIALIZER;
 
 int x264_analyse_init_costs( x264_t *h, int qp )
 {
@@ -1101,7 +1101,7 @@ static void x264_intra_rd_refine( x264_t *h, x264_mb_analysis_t *a )
         {
             uint64_t pels_h = 0;
             uint8_t pels_v[7];
-            uint16_t i_nnz[2];
+            uint16_t i_nnz[2] = {0}; //shut up gcc
             uint8_t *p_dst_by;
             int j;
             int cbp_luma_new = 0;



More information about the x264-devel mailing list