[x264-devel] commit: Really fix gcc win32 misalignment crash (Jason Garrett-Glaser )

git at videolan.org git at videolan.org
Mon Jan 10 22:00:53 CET 2011


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Sat Dec 18 08:22:34 2010 -0800| [b59be2b931c30b17cf29186ddcce11d493d140d1] | committer: Jason Garrett-Glaser 

Really fix gcc win32 misalignment crash
gcc's -fno-zero-initialized-in-bss only works if an explicit initializer (e.g. = {0}) is used.

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

 encoder/me.c        |    2 +-
 encoder/rdo.c       |    4 ++--
 encoder/slicetype.c |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/encoder/me.c b/encoder/me.c
index 8833973..2da3003 100644
--- a/encoder/me.c
+++ b/encoder/me.c
@@ -589,7 +589,7 @@ void x264_me_search_ref( x264_t *h, x264_me_t *m, int16_t (*mvc)[2], int i_mvc,
             /* successive elimination by comparing DC before a full SAD,
              * because sum(abs(diff)) >= abs(diff(sum)). */
             uint16_t *sums_base = m->integral;
-            ALIGNED_16( static pixel zero[8*FENC_STRIDE] );
+            ALIGNED_16( static pixel zero[8*FENC_STRIDE] ) = {0};
             ALIGNED_ARRAY_16( int, enc_dc,[4] );
             int sad_size = i_pixel <= PIXEL_8x8 ? PIXEL_8x8 : PIXEL_4x4;
             int delta = x264_pixel_size[sad_size].w;
diff --git a/encoder/rdo.c b/encoder/rdo.c
index c5c744e..297d123 100644
--- a/encoder/rdo.c
+++ b/encoder/rdo.c
@@ -92,7 +92,7 @@ static ALWAYS_INLINE int cached_satd( x264_t *h, int size, int x, int y )
     static const uint8_t satd_shift_x[3] = {3,   2,   2};
     static const uint8_t satd_shift_y[3] = {2-1, 3-2, 2-2};
     static const uint8_t  satd_offset[3] = {0,   8,   16};
-    ALIGNED_16( static pixel zero[16] );
+    ALIGNED_16( static pixel zero[16] ) = {0};
     int cache_index = (x >> satd_shift_x[size - PIXEL_8x4]) + (y >> satd_shift_y[size - PIXEL_8x4])
                     + satd_offset[size - PIXEL_8x4];
     int res = h->mb.pic.fenc_satd_cache[cache_index];
@@ -119,7 +119,7 @@ static ALWAYS_INLINE int cached_satd( x264_t *h, int size, int x, int y )
 
 static inline int ssd_plane( x264_t *h, int size, int p, int x, int y )
 {
-    ALIGNED_16( static pixel zero[16] );
+    ALIGNED_16( static pixel zero[16] ) = {0};
     int satd = 0;
     pixel *fdec = h->mb.pic.p_fdec[p] + x + y*FDEC_STRIDE;
     pixel *fenc = h->mb.pic.p_fenc[p] + x + y*FENC_STRIDE;
diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index 93d3ea7..7eff570 100644
--- a/encoder/slicetype.c
+++ b/encoder/slicetype.c
@@ -191,7 +191,7 @@ static NOINLINE unsigned int x264_weight_cost_chroma( x264_t *h, x264_frame_t *f
     pixel *src = ref + i_offset;
     ALIGNED_ARRAY_16( pixel, buf, [8*8] );
     int pixoff = 0;
-    ALIGNED_16( static pixel flat[8] );
+    ALIGNED_16( static pixel flat[8] ) = {0};
     if( w )
     {
         for( int y = 0; y < i_lines; y += 8, pixoff = y*i_stride )



More information about the x264-devel mailing list