changeset 2471:805431763e84 libavcodec

fixing missaligned memory accesses in fill_rectangle()
author michael
date Sun, 30 Jan 2005 02:16:50 +0000
parents 06aafb585f69
children 021dc26e760f
files h264.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Sat Jan 29 23:59:32 2005 +0000
+++ b/h264.c	Sun Jan 30 02:16:50 2005 +0000
@@ -182,14 +182,14 @@
      * non zero coeff count cache.
      * is 64 if not available.
      */
-    uint8_t non_zero_count_cache[6*8];
+    uint8_t non_zero_count_cache[6*8] __align8;
     uint8_t (*non_zero_count)[16];
 
     /**
      * Motion vector cache.
      */
-    int16_t mv_cache[2][5*8][2];
-    int8_t ref_cache[2][5*8];
+    int16_t mv_cache[2][5*8][2] __align8;
+    int8_t ref_cache[2][5*8] __align8;
 #define LIST_NOT_USED -1 //FIXME rename?
 #define PART_NOT_AVAILABLE -2
     
@@ -318,7 +318,7 @@
     uint8_t     *chroma_pred_mode_table;
     int         last_qscale_diff;
     int16_t     (*mvd_table[2])[2];
-    int16_t     mvd_cache[2][5*8][2];
+    int16_t     mvd_cache[2][5*8][2] __align8;
     uint8_t     *direct_table;
     uint8_t     direct_cache[5*8];
 
@@ -358,6 +358,7 @@
     w      *= size;
     stride *= size;
     
+    assert((((int)vp)&(FFMIN(w, STRIDE_ALIGN)-1)) == 0);
 //FIXME check what gcc generates for 64 bit on x86 and possible write a 32 bit ver of it
     if(w==2 && h==2){
         *(uint16_t*)(p + 0)=