changeset 5520:c16a59ef6a86 libavcodec

* renaming (ST|LD)(16|32|64) -> AV_(R|W)N(16|32|64)
author romansh
date Thu, 09 Aug 2007 17:01:15 +0000
parents b790f8c0ee24
children 6232e9874f46
files cavs.c dsputil.c dsputil.h ptx.c sh4/qpel.c
diffstat 5 files changed, 125 insertions(+), 127 deletions(-) [+]
line wrap: on
line diff
--- a/cavs.c	Thu Aug 09 01:08:28 2007 +0000
+++ b/cavs.c	Thu Aug 09 17:01:15 2007 +0000
@@ -212,7 +212,7 @@
 
 static void intra_pred_vert(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
     int y;
-    uint64_t a = LD64(&top[1]);
+    uint64_t a = AV_RN64(&top[1]);
     for(y=0;y<8;y++) {
         *((uint64_t *)(d+y*stride)) = a;
     }
--- a/dsputil.c	Thu Aug 09 01:08:28 2007 +0000
+++ b/dsputil.c	Thu Aug 09 17:01:15 2007 +0000
@@ -608,7 +608,7 @@
 {\
     int i;\
     for(i=0; i<h; i++){\
-        OP(*((uint64_t*)block), LD64(pixels));\
+        OP(*((uint64_t*)block), AV_RN64(pixels));\
         pixels+=line_size;\
         block +=line_size;\
     }\
@@ -618,8 +618,8 @@
 {\
     int i;\
     for(i=0; i<h; i++){\
-        const uint64_t a= LD64(pixels  );\
-        const uint64_t b= LD64(pixels+1);\
+        const uint64_t a= AV_RN64(pixels  );\
+        const uint64_t b= AV_RN64(pixels+1);\
         OP(*((uint64_t*)block), (a&b) + (((a^b)&0xFEFEFEFEFEFEFEFEULL)>>1));\
         pixels+=line_size;\
         block +=line_size;\
@@ -630,8 +630,8 @@
 {\
     int i;\
     for(i=0; i<h; i++){\
-        const uint64_t a= LD64(pixels  );\
-        const uint64_t b= LD64(pixels+1);\
+        const uint64_t a= AV_RN64(pixels  );\
+        const uint64_t b= AV_RN64(pixels+1);\
         OP(*((uint64_t*)block), (a|b) - (((a^b)&0xFEFEFEFEFEFEFEFEULL)>>1));\
         pixels+=line_size;\
         block +=line_size;\
@@ -642,8 +642,8 @@
 {\
     int i;\
     for(i=0; i<h; i++){\
-        const uint64_t a= LD64(pixels          );\
-        const uint64_t b= LD64(pixels+line_size);\
+        const uint64_t a= AV_RN64(pixels          );\
+        const uint64_t b= AV_RN64(pixels+line_size);\
         OP(*((uint64_t*)block), (a&b) + (((a^b)&0xFEFEFEFEFEFEFEFEULL)>>1));\
         pixels+=line_size;\
         block +=line_size;\
@@ -654,8 +654,8 @@
 {\
     int i;\
     for(i=0; i<h; i++){\
-        const uint64_t a= LD64(pixels          );\
-        const uint64_t b= LD64(pixels+line_size);\
+        const uint64_t a= AV_RN64(pixels          );\
+        const uint64_t b= AV_RN64(pixels+line_size);\
         OP(*((uint64_t*)block), (a|b) - (((a^b)&0xFEFEFEFEFEFEFEFEULL)>>1));\
         pixels+=line_size;\
         block +=line_size;\
@@ -665,8 +665,8 @@
 static void OPNAME ## _pixels_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
 {\
         int i;\
-        const uint64_t a= LD64(pixels  );\
-        const uint64_t b= LD64(pixels+1);\
+        const uint64_t a= AV_RN64(pixels  );\
+        const uint64_t b= AV_RN64(pixels+1);\
         uint64_t l0=  (a&0x0303030303030303ULL)\
                     + (b&0x0303030303030303ULL)\
                     + 0x0202020202020202ULL;\
@@ -676,8 +676,8 @@
 \
         pixels+=line_size;\
         for(i=0; i<h; i+=2){\
-            uint64_t a= LD64(pixels  );\
-            uint64_t b= LD64(pixels+1);\
+            uint64_t a= AV_RN64(pixels  );\
+            uint64_t b= AV_RN64(pixels+1);\
             l1=  (a&0x0303030303030303ULL)\
                + (b&0x0303030303030303ULL);\
             h1= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\
@@ -685,8 +685,8 @@
             OP(*((uint64_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0F0F0F0F0FULL));\
             pixels+=line_size;\
             block +=line_size;\
-            a= LD64(pixels  );\
-            b= LD64(pixels+1);\
+            a= AV_RN64(pixels  );\
+            b= AV_RN64(pixels+1);\
             l0=  (a&0x0303030303030303ULL)\
                + (b&0x0303030303030303ULL)\
                + 0x0202020202020202ULL;\
@@ -701,8 +701,8 @@
 static void OPNAME ## _no_rnd_pixels_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
 {\
         int i;\
-        const uint64_t a= LD64(pixels  );\
-        const uint64_t b= LD64(pixels+1);\
+        const uint64_t a= AV_RN64(pixels  );\
+        const uint64_t b= AV_RN64(pixels+1);\
         uint64_t l0=  (a&0x0303030303030303ULL)\
                     + (b&0x0303030303030303ULL)\
                     + 0x0101010101010101ULL;\
@@ -712,8 +712,8 @@
 \
         pixels+=line_size;\
         for(i=0; i<h; i+=2){\
-            uint64_t a= LD64(pixels  );\
-            uint64_t b= LD64(pixels+1);\
+            uint64_t a= AV_RN64(pixels  );\
+            uint64_t b= AV_RN64(pixels+1);\
             l1=  (a&0x0303030303030303ULL)\
                + (b&0x0303030303030303ULL);\
             h1= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\
@@ -721,8 +721,8 @@
             OP(*((uint64_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0F0F0F0F0FULL));\
             pixels+=line_size;\
             block +=line_size;\
-            a= LD64(pixels  );\
-            b= LD64(pixels+1);\
+            a= AV_RN64(pixels  );\
+            b= AV_RN64(pixels+1);\
             l0=  (a&0x0303030303030303ULL)\
                + (b&0x0303030303030303ULL)\
                + 0x0101010101010101ULL;\
@@ -749,7 +749,7 @@
 static void OPNAME ## _pixels2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
     int i;\
     for(i=0; i<h; i++){\
-        OP(*((uint16_t*)(block  )), LD16(pixels  ));\
+        OP(*((uint16_t*)(block  )), AV_RN16(pixels  ));\
         pixels+=line_size;\
         block +=line_size;\
     }\
@@ -757,7 +757,7 @@
 static void OPNAME ## _pixels4_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
     int i;\
     for(i=0; i<h; i++){\
-        OP(*((uint32_t*)(block  )), LD32(pixels  ));\
+        OP(*((uint32_t*)(block  )), AV_RN32(pixels  ));\
         pixels+=line_size;\
         block +=line_size;\
     }\
@@ -765,8 +765,8 @@
 static void OPNAME ## _pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
     int i;\
     for(i=0; i<h; i++){\
-        OP(*((uint32_t*)(block  )), LD32(pixels  ));\
-        OP(*((uint32_t*)(block+4)), LD32(pixels+4));\
+        OP(*((uint32_t*)(block  )), AV_RN32(pixels  ));\
+        OP(*((uint32_t*)(block+4)), AV_RN32(pixels+4));\
         pixels+=line_size;\
         block +=line_size;\
     }\
@@ -780,11 +780,11 @@
     int i;\
     for(i=0; i<h; i++){\
         uint32_t a,b;\
-        a= LD32(&src1[i*src_stride1  ]);\
-        b= LD32(&src2[i*src_stride2  ]);\
+        a= AV_RN32(&src1[i*src_stride1  ]);\
+        b= AV_RN32(&src2[i*src_stride2  ]);\
         OP(*((uint32_t*)&dst[i*dst_stride  ]), no_rnd_avg32(a, b));\
-        a= LD32(&src1[i*src_stride1+4]);\
-        b= LD32(&src2[i*src_stride2+4]);\
+        a= AV_RN32(&src1[i*src_stride1+4]);\
+        b= AV_RN32(&src2[i*src_stride2+4]);\
         OP(*((uint32_t*)&dst[i*dst_stride+4]), no_rnd_avg32(a, b));\
     }\
 }\
@@ -794,11 +794,11 @@
     int i;\
     for(i=0; i<h; i++){\
         uint32_t a,b;\
-        a= LD32(&src1[i*src_stride1  ]);\
-        b= LD32(&src2[i*src_stride2  ]);\
+        a= AV_RN32(&src1[i*src_stride1  ]);\
+        b= AV_RN32(&src2[i*src_stride2  ]);\
         OP(*((uint32_t*)&dst[i*dst_stride  ]), rnd_avg32(a, b));\
-        a= LD32(&src1[i*src_stride1+4]);\
-        b= LD32(&src2[i*src_stride2+4]);\
+        a= AV_RN32(&src1[i*src_stride1+4]);\
+        b= AV_RN32(&src2[i*src_stride2+4]);\
         OP(*((uint32_t*)&dst[i*dst_stride+4]), rnd_avg32(a, b));\
     }\
 }\
@@ -808,8 +808,8 @@
     int i;\
     for(i=0; i<h; i++){\
         uint32_t a,b;\
-        a= LD32(&src1[i*src_stride1  ]);\
-        b= LD32(&src2[i*src_stride2  ]);\
+        a= AV_RN32(&src1[i*src_stride1  ]);\
+        b= AV_RN32(&src2[i*src_stride2  ]);\
         OP(*((uint32_t*)&dst[i*dst_stride  ]), rnd_avg32(a, b));\
     }\
 }\
@@ -819,8 +819,8 @@
     int i;\
     for(i=0; i<h; i++){\
         uint32_t a,b;\
-        a= LD16(&src1[i*src_stride1  ]);\
-        b= LD16(&src2[i*src_stride2  ]);\
+        a= AV_RN16(&src1[i*src_stride1  ]);\
+        b= AV_RN16(&src2[i*src_stride2  ]);\
         OP(*((uint16_t*)&dst[i*dst_stride  ]), rnd_avg32(a, b));\
     }\
 }\
@@ -858,10 +858,10 @@
     int i;\
     for(i=0; i<h; i++){\
         uint32_t a, b, c, d, l0, l1, h0, h1;\
-        a= LD32(&src1[i*src_stride1]);\
-        b= LD32(&src2[i*src_stride2]);\
-        c= LD32(&src3[i*src_stride3]);\
-        d= LD32(&src4[i*src_stride4]);\
+        a= AV_RN32(&src1[i*src_stride1]);\
+        b= AV_RN32(&src2[i*src_stride2]);\
+        c= AV_RN32(&src3[i*src_stride3]);\
+        d= AV_RN32(&src4[i*src_stride4]);\
         l0=  (a&0x03030303UL)\
            + (b&0x03030303UL)\
            + 0x02020202UL;\
@@ -872,10 +872,10 @@
         h1= ((c&0xFCFCFCFCUL)>>2)\
           + ((d&0xFCFCFCFCUL)>>2);\
         OP(*((uint32_t*)&dst[i*dst_stride]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
-        a= LD32(&src1[i*src_stride1+4]);\
-        b= LD32(&src2[i*src_stride2+4]);\
-        c= LD32(&src3[i*src_stride3+4]);\
-        d= LD32(&src4[i*src_stride4+4]);\
+        a= AV_RN32(&src1[i*src_stride1+4]);\
+        b= AV_RN32(&src2[i*src_stride2+4]);\
+        c= AV_RN32(&src3[i*src_stride3+4]);\
+        d= AV_RN32(&src4[i*src_stride4+4]);\
         l0=  (a&0x03030303UL)\
            + (b&0x03030303UL)\
            + 0x02020202UL;\
@@ -910,10 +910,10 @@
     int i;\
     for(i=0; i<h; i++){\
         uint32_t a, b, c, d, l0, l1, h0, h1;\
-        a= LD32(&src1[i*src_stride1]);\
-        b= LD32(&src2[i*src_stride2]);\
-        c= LD32(&src3[i*src_stride3]);\
-        d= LD32(&src4[i*src_stride4]);\
+        a= AV_RN32(&src1[i*src_stride1]);\
+        b= AV_RN32(&src2[i*src_stride2]);\
+        c= AV_RN32(&src3[i*src_stride3]);\
+        d= AV_RN32(&src4[i*src_stride4]);\
         l0=  (a&0x03030303UL)\
            + (b&0x03030303UL)\
            + 0x01010101UL;\
@@ -924,10 +924,10 @@
         h1= ((c&0xFCFCFCFCUL)>>2)\
           + ((d&0xFCFCFCFCUL)>>2);\
         OP(*((uint32_t*)&dst[i*dst_stride]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
-        a= LD32(&src1[i*src_stride1+4]);\
-        b= LD32(&src2[i*src_stride2+4]);\
-        c= LD32(&src3[i*src_stride3+4]);\
-        d= LD32(&src4[i*src_stride4+4]);\
+        a= AV_RN32(&src1[i*src_stride1+4]);\
+        b= AV_RN32(&src2[i*src_stride2+4]);\
+        c= AV_RN32(&src3[i*src_stride3+4]);\
+        d= AV_RN32(&src4[i*src_stride4+4]);\
         l0=  (a&0x03030303UL)\
            + (b&0x03030303UL)\
            + 0x01010101UL;\
@@ -987,8 +987,8 @@
 static inline void OPNAME ## _pixels4_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
 {\
         int i;\
-        const uint32_t a= LD32(pixels  );\
-        const uint32_t b= LD32(pixels+1);\
+        const uint32_t a= AV_RN32(pixels  );\
+        const uint32_t b= AV_RN32(pixels+1);\
         uint32_t l0=  (a&0x03030303UL)\
                     + (b&0x03030303UL)\
                     + 0x02020202UL;\
@@ -998,8 +998,8 @@
 \
         pixels+=line_size;\
         for(i=0; i<h; i+=2){\
-            uint32_t a= LD32(pixels  );\
-            uint32_t b= LD32(pixels+1);\
+            uint32_t a= AV_RN32(pixels  );\
+            uint32_t b= AV_RN32(pixels+1);\
             l1=  (a&0x03030303UL)\
                + (b&0x03030303UL);\
             h1= ((a&0xFCFCFCFCUL)>>2)\
@@ -1007,8 +1007,8 @@
             OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
             pixels+=line_size;\
             block +=line_size;\
-            a= LD32(pixels  );\
-            b= LD32(pixels+1);\
+            a= AV_RN32(pixels  );\
+            b= AV_RN32(pixels+1);\
             l0=  (a&0x03030303UL)\
                + (b&0x03030303UL)\
                + 0x02020202UL;\
@@ -1025,8 +1025,8 @@
     int j;\
     for(j=0; j<2; j++){\
         int i;\
-        const uint32_t a= LD32(pixels  );\
-        const uint32_t b= LD32(pixels+1);\
+        const uint32_t a= AV_RN32(pixels  );\
+        const uint32_t b= AV_RN32(pixels+1);\
         uint32_t l0=  (a&0x03030303UL)\
                     + (b&0x03030303UL)\
                     + 0x02020202UL;\
@@ -1036,8 +1036,8 @@
 \
         pixels+=line_size;\
         for(i=0; i<h; i+=2){\
-            uint32_t a= LD32(pixels  );\
-            uint32_t b= LD32(pixels+1);\
+            uint32_t a= AV_RN32(pixels  );\
+            uint32_t b= AV_RN32(pixels+1);\
             l1=  (a&0x03030303UL)\
                + (b&0x03030303UL);\
             h1= ((a&0xFCFCFCFCUL)>>2)\
@@ -1045,8 +1045,8 @@
             OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
             pixels+=line_size;\
             block +=line_size;\
-            a= LD32(pixels  );\
-            b= LD32(pixels+1);\
+            a= AV_RN32(pixels  );\
+            b= AV_RN32(pixels+1);\
             l0=  (a&0x03030303UL)\
                + (b&0x03030303UL)\
                + 0x02020202UL;\
@@ -1066,8 +1066,8 @@
     int j;\
     for(j=0; j<2; j++){\
         int i;\
-        const uint32_t a= LD32(pixels  );\
-        const uint32_t b= LD32(pixels+1);\
+        const uint32_t a= AV_RN32(pixels  );\
+        const uint32_t b= AV_RN32(pixels+1);\
         uint32_t l0=  (a&0x03030303UL)\
                     + (b&0x03030303UL)\
                     + 0x01010101UL;\
@@ -1077,8 +1077,8 @@
 \
         pixels+=line_size;\
         for(i=0; i<h; i+=2){\
-            uint32_t a= LD32(pixels  );\
-            uint32_t b= LD32(pixels+1);\
+            uint32_t a= AV_RN32(pixels  );\
+            uint32_t b= AV_RN32(pixels+1);\
             l1=  (a&0x03030303UL)\
                + (b&0x03030303UL);\
             h1= ((a&0xFCFCFCFCUL)>>2)\
@@ -1086,8 +1086,8 @@
             OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
             pixels+=line_size;\
             block +=line_size;\
-            a= LD32(pixels  );\
-            b= LD32(pixels+1);\
+            a= AV_RN32(pixels  );\
+            b= AV_RN32(pixels+1);\
             l0=  (a&0x03030303UL)\
                + (b&0x03030303UL)\
                + 0x01010101UL;\
--- a/dsputil.h	Thu Aug 09 01:08:28 2007 +0000
+++ b/dsputil.h	Thu Aug 09 17:01:15 2007 +0000
@@ -675,7 +675,7 @@
     int i;
     for(i=0; i<h; i++)
     {
-        ST16(dst   , LD16(src   ));
+        AV_WN16(dst   , AV_RN16(src   ));
         dst+=dstStride;
         src+=srcStride;
     }
@@ -686,7 +686,7 @@
     int i;
     for(i=0; i<h; i++)
     {
-        ST32(dst   , LD32(src   ));
+        AV_WN32(dst   , AV_RN32(src   ));
         dst+=dstStride;
         src+=srcStride;
     }
@@ -697,8 +697,8 @@
     int i;
     for(i=0; i<h; i++)
     {
-        ST32(dst   , LD32(src   ));
-        ST32(dst+4 , LD32(src+4 ));
+        AV_WN32(dst   , AV_RN32(src   ));
+        AV_WN32(dst+4 , AV_RN32(src+4 ));
         dst+=dstStride;
         src+=srcStride;
     }
@@ -709,8 +709,8 @@
     int i;
     for(i=0; i<h; i++)
     {
-        ST32(dst   , LD32(src   ));
-        ST32(dst+4 , LD32(src+4 ));
+        AV_WN32(dst   , AV_RN32(src   ));
+        AV_WN32(dst+4 , AV_RN32(src+4 ));
         dst[8]= src[8];
         dst+=dstStride;
         src+=srcStride;
@@ -722,10 +722,10 @@
     int i;
     for(i=0; i<h; i++)
     {
-        ST32(dst   , LD32(src   ));
-        ST32(dst+4 , LD32(src+4 ));
-        ST32(dst+8 , LD32(src+8 ));
-        ST32(dst+12, LD32(src+12));
+        AV_WN32(dst   , AV_RN32(src   ));
+        AV_WN32(dst+4 , AV_RN32(src+4 ));
+        AV_WN32(dst+8 , AV_RN32(src+8 ));
+        AV_WN32(dst+12, AV_RN32(src+12));
         dst+=dstStride;
         src+=srcStride;
     }
@@ -736,10 +736,10 @@
     int i;
     for(i=0; i<h; i++)
     {
-        ST32(dst   , LD32(src   ));
-        ST32(dst+4 , LD32(src+4 ));
-        ST32(dst+8 , LD32(src+8 ));
-        ST32(dst+12, LD32(src+12));
+        AV_WN32(dst   , AV_RN32(src   ));
+        AV_WN32(dst+4 , AV_RN32(src+4 ));
+        AV_WN32(dst+8 , AV_RN32(src+8 ));
+        AV_WN32(dst+12, AV_RN32(src+12));
         dst[16]= src[16];
         dst+=dstStride;
         src+=srcStride;
--- a/ptx.c	Thu Aug 09 01:08:28 2007 +0000
+++ b/ptx.c	Thu Aug 09 17:01:15 2007 +0000
@@ -81,7 +81,7 @@
 #ifdef WORDS_BIGENDIAN
         unsigned int x;
         for (x=0; x<w*bytes_per_pixel; x+=bytes_per_pixel)
-            ST16(ptr+x, AV_RL16(buf+x));
+            AV_WN16(ptr+x, AV_RL16(buf+x));
 #else
         memcpy(ptr, buf, w*bytes_per_pixel);
 #endif
--- a/sh4/qpel.c	Thu Aug 09 01:08:28 2007 +0000
+++ b/sh4/qpel.c	Thu Aug 09 17:01:15 2007 +0000
@@ -21,14 +21,12 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#define         LD(adr) *(uint32_t*)(adr)
-
 #define PIXOP2(OPNAME, OP) \
 /*static inline void OPNAME ## _no_rnd_pixels8_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
 {\
         do {\
-                OP(LP(dst  ),no_rnd_avg32(LD32(src1  ),LD32(src2  )) ); \
-                OP(LP(dst+4),no_rnd_avg32(LD32(src1+4),LD32(src2+4)) ); \
+                OP(LP(dst  ),no_rnd_avg32(AV_RN32(src1  ),AV_RN32(src2  )) ); \
+                OP(LP(dst+4),no_rnd_avg32(AV_RN32(src1+4),AV_RN32(src2+4)) ); \
                 src1+=src_stride1; \
                 src2+=src_stride2; \
                 dst+=dst_stride; \
@@ -38,8 +36,8 @@
 static inline void OPNAME ## _pixels8_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
 {\
         do {\
-                OP(LP(dst  ),rnd_avg32(LD32(src1  ),LD32(src2  )) ); \
-                OP(LP(dst+4),rnd_avg32(LD32(src1+4),LD32(src2+4)) ); \
+                OP(LP(dst  ),rnd_avg32(AV_RN32(src1  ),AV_RN32(src2  )) ); \
+                OP(LP(dst+4),rnd_avg32(AV_RN32(src1+4),AV_RN32(src2+4)) ); \
                 src1+=src_stride1; \
                 src2+=src_stride2; \
                 dst+=dst_stride; \
@@ -49,7 +47,7 @@
 static inline void OPNAME ## _pixels4_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
 {\
         do {\
-                OP(LP(dst  ),rnd_avg32(LD32(src1  ),LD32(src2  )) ); \
+                OP(LP(dst  ),rnd_avg32(AV_RN32(src1  ),AV_RN32(src2  )) ); \
                 src1+=src_stride1; \
                 src2+=src_stride2; \
                 dst+=dst_stride; \
@@ -59,10 +57,10 @@
 static inline void OPNAME ## _no_rnd_pixels16_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
 {\
         do {\
-                OP(LP(dst  ),no_rnd_avg32(LD32(src1  ),LD32(src2  )) ); \
-                OP(LP(dst+4),no_rnd_avg32(LD32(src1+4),LD32(src2+4)) ); \
-                OP(LP(dst+8),no_rnd_avg32(LD32(src1+8),LD32(src2+8)) ); \
-                OP(LP(dst+12),no_rnd_avg32(LD32(src1+12),LD32(src2+12)) ); \
+                OP(LP(dst  ),no_rnd_avg32(AV_RN32(src1  ),AV_RN32(src2  )) ); \
+                OP(LP(dst+4),no_rnd_avg32(AV_RN32(src1+4),AV_RN32(src2+4)) ); \
+                OP(LP(dst+8),no_rnd_avg32(AV_RN32(src1+8),AV_RN32(src2+8)) ); \
+                OP(LP(dst+12),no_rnd_avg32(AV_RN32(src1+12),AV_RN32(src2+12)) ); \
                 src1+=src_stride1; \
                 src2+=src_stride2; \
                 dst+=dst_stride; \
@@ -72,10 +70,10 @@
 static inline void OPNAME ## _pixels16_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
 {\
         do {\
-                OP(LP(dst  ),rnd_avg32(LD32(src1  ),LD32(src2  )) ); \
-                OP(LP(dst+4),rnd_avg32(LD32(src1+4),LD32(src2+4)) ); \
-                OP(LP(dst+8),rnd_avg32(LD32(src1+8),LD32(src2+8)) ); \
-                OP(LP(dst+12),rnd_avg32(LD32(src1+12),LD32(src2+12)) ); \
+                OP(LP(dst  ),rnd_avg32(AV_RN32(src1  ),AV_RN32(src2  )) ); \
+                OP(LP(dst+4),rnd_avg32(AV_RN32(src1+4),AV_RN32(src2+4)) ); \
+                OP(LP(dst+8),rnd_avg32(AV_RN32(src1+8),AV_RN32(src2+8)) ); \
+                OP(LP(dst+12),rnd_avg32(AV_RN32(src1+12),AV_RN32(src2+12)) ); \
                 src1+=src_stride1; \
                 src2+=src_stride2; \
                 dst+=dst_stride; \
@@ -95,7 +93,7 @@
 static inline void OPNAME ## _pixels4_l2_aligned2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
 {\
         do {\
-                OP(LP(dst  ),rnd_avg32(LD32(src1  ),LP(src2  )) ); \
+                OP(LP(dst  ),rnd_avg32(AV_RN32(src1  ),LP(src2  )) ); \
                 src1+=src_stride1; \
                 src2+=src_stride2; \
                 dst+=dst_stride; \
@@ -105,10 +103,10 @@
 static inline void OPNAME ## _no_rnd_pixels16_l2_aligned2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
 {\
         do {\
-                OP(LP(dst  ),no_rnd_avg32(LD32(src1  ),LP(src2  )) ); \
-                OP(LP(dst+4),no_rnd_avg32(LD32(src1+4),LP(src2+4)) ); \
-                OP(LP(dst+8),no_rnd_avg32(LD32(src1+8),LP(src2+8)) ); \
-                OP(LP(dst+12),no_rnd_avg32(LD32(src1+12),LP(src2+12)) ); \
+                OP(LP(dst  ),no_rnd_avg32(AV_RN32(src1  ),LP(src2  )) ); \
+                OP(LP(dst+4),no_rnd_avg32(AV_RN32(src1+4),LP(src2+4)) ); \
+                OP(LP(dst+8),no_rnd_avg32(AV_RN32(src1+8),LP(src2+8)) ); \
+                OP(LP(dst+12),no_rnd_avg32(AV_RN32(src1+12),LP(src2+12)) ); \
                 src1+=src_stride1; \
                 src2+=src_stride2; \
                 dst+=dst_stride; \
@@ -118,10 +116,10 @@
 static inline void OPNAME ## _pixels16_l2_aligned2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
 {\
         do {\
-                OP(LP(dst  ),rnd_avg32(LD32(src1  ),LP(src2  )) ); \
-                OP(LP(dst+4),rnd_avg32(LD32(src1+4),LP(src2+4)) ); \
-                OP(LP(dst+8),rnd_avg32(LD32(src1+8),LP(src2+8)) ); \
-                OP(LP(dst+12),rnd_avg32(LD32(src1+12),LP(src2+12)) ); \
+                OP(LP(dst  ),rnd_avg32(AV_RN32(src1  ),LP(src2  )) ); \
+                OP(LP(dst+4),rnd_avg32(AV_RN32(src1+4),LP(src2+4)) ); \
+                OP(LP(dst+8),rnd_avg32(AV_RN32(src1+8),LP(src2+8)) ); \
+                OP(LP(dst+12),rnd_avg32(AV_RN32(src1+12),LP(src2+12)) ); \
                 src1+=src_stride1; \
                 src2+=src_stride2; \
                 dst+=dst_stride; \
@@ -131,8 +129,8 @@
 static inline void OPNAME ## _no_rnd_pixels8_l2_aligned2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
 {\
         do { /* onlye src2 aligned */\
-                OP(LP(dst  ),no_rnd_avg32(LD32(src1  ),LP(src2  )) ); \
-                OP(LP(dst+4),no_rnd_avg32(LD32(src1+4),LP(src2+4)) ); \
+                OP(LP(dst  ),no_rnd_avg32(AV_RN32(src1  ),LP(src2  )) ); \
+                OP(LP(dst+4),no_rnd_avg32(AV_RN32(src1+4),LP(src2+4)) ); \
                 src1+=src_stride1; \
                 src2+=src_stride2; \
                 dst+=dst_stride; \
@@ -142,8 +140,8 @@
 static inline void OPNAME ## _pixels8_l2_aligned2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
 {\
         do {\
-                OP(LP(dst  ),rnd_avg32(LD32(src1  ),LP(src2  )) ); \
-                OP(LP(dst+4),rnd_avg32(LD32(src1+4),LP(src2+4)) ); \
+                OP(LP(dst  ),rnd_avg32(AV_RN32(src1  ),LP(src2  )) ); \
+                OP(LP(dst+4),rnd_avg32(AV_RN32(src1+4),LP(src2+4)) ); \
                 src1+=src_stride1; \
                 src2+=src_stride2; \
                 dst+=dst_stride; \
@@ -247,10 +245,10 @@
 static inline void OPNAME ## _pixels8_l4_aligned0(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
         do { \
                 uint32_t a0,a1,a2,a3; /* src1 only not aligned */\
-                UNPACK(a0,a1,LD32(src1),LP(src2)); \
+                UNPACK(a0,a1,AV_RN32(src1),LP(src2)); \
                 UNPACK(a2,a3,LP(src3),LP(src4)); \
                 OP(LP(dst),rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LD32(src1+4),LP(src2+4)); \
+                UNPACK(a0,a1,AV_RN32(src1+4),LP(src2+4)); \
                 UNPACK(a2,a3,LP(src3+4),LP(src4+4)); \
                 OP(LP(dst+4),rnd_PACK(a0,a1,a2,a3)); \
                 src1+=src_stride1;\
@@ -264,10 +262,10 @@
 static inline void OPNAME ## _no_rnd_pixels8_l4_aligned0(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
         do { \
                 uint32_t a0,a1,a2,a3; \
-                UNPACK(a0,a1,LD32(src1),LP(src2)); \
+                UNPACK(a0,a1,AV_RN32(src1),LP(src2)); \
                 UNPACK(a2,a3,LP(src3),LP(src4)); \
                 OP(LP(dst),no_rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LD32(src1+4),LP(src2+4)); \
+                UNPACK(a0,a1,AV_RN32(src1+4),LP(src2+4)); \
                 UNPACK(a2,a3,LP(src3+4),LP(src4+4)); \
                 OP(LP(dst+4),no_rnd_PACK(a0,a1,a2,a3)); \
                 src1+=src_stride1;\
@@ -327,16 +325,16 @@
 static inline void OPNAME ## _pixels16_l4_aligned0(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
         do { /* src1 is unaligned */\
                 uint32_t a0,a1,a2,a3; \
-                UNPACK(a0,a1,LD32(src1),LP(src2)); \
+                UNPACK(a0,a1,AV_RN32(src1),LP(src2)); \
                 UNPACK(a2,a3,LP(src3),LP(src4)); \
                 OP(LP(dst),rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LD32(src1+4),LP(src2+4)); \
+                UNPACK(a0,a1,AV_RN32(src1+4),LP(src2+4)); \
                 UNPACK(a2,a3,LP(src3+4),LP(src4+4)); \
                 OP(LP(dst+8),rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LD32(src1+8),LP(src2+8)); \
+                UNPACK(a0,a1,AV_RN32(src1+8),LP(src2+8)); \
                 UNPACK(a2,a3,LP(src3+8),LP(src4+8)); \
                 OP(LP(dst+8),rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LD32(src1+12),LP(src2+12)); \
+                UNPACK(a0,a1,AV_RN32(src1+12),LP(src2+12)); \
                 UNPACK(a2,a3,LP(src3+12),LP(src4+12)); \
                 OP(LP(dst+12),rnd_PACK(a0,a1,a2,a3)); \
                 src1+=src_stride1;\
@@ -350,16 +348,16 @@
 static inline void OPNAME ## _no_rnd_pixels16_l4_aligned0(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
         do { \
                 uint32_t a0,a1,a2,a3; \
-                UNPACK(a0,a1,LD32(src1),LP(src2)); \
+                UNPACK(a0,a1,AV_RN32(src1),LP(src2)); \
                 UNPACK(a2,a3,LP(src3),LP(src4)); \
                 OP(LP(dst),no_rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LD32(src1+4),LP(src2+4)); \
+                UNPACK(a0,a1,AV_RN32(src1+4),LP(src2+4)); \
                 UNPACK(a2,a3,LP(src3+4),LP(src4+4)); \
                 OP(LP(dst+4),no_rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LD32(src1+8),LP(src2+8)); \
+                UNPACK(a0,a1,AV_RN32(src1+8),LP(src2+8)); \
                 UNPACK(a2,a3,LP(src3+8),LP(src4+8)); \
                 OP(LP(dst+8),no_rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LD32(src1+12),LP(src2+12)); \
+                UNPACK(a0,a1,AV_RN32(src1+12),LP(src2+12)); \
                 UNPACK(a2,a3,LP(src3+12),LP(src4+12)); \
                 OP(LP(dst+12),no_rnd_PACK(a0,a1,a2,a3)); \
                 src1+=src_stride1;\