Browse Source

avcodec/intrax8dsp: Copy several bytes at once

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Andreas Rheinhardt 2 weeks ago
parent
commit
90d9e2a26c
1 changed files with 7 additions and 15 deletions
  1. 7 15
      libavcodec/intrax8dsp.c

+ 7 - 15
libavcodec/intrax8dsp.c

@@ -23,6 +23,7 @@
 
 #include "intrax8dsp.h"
 #include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
 
 /*
  * area positions, #3 is 1 pixel only, other are 8 pixels
@@ -226,22 +227,16 @@ static void spatial_compensation_1(const uint8_t *restrict src, uint8_t *restric
 
 static void spatial_compensation_2(const uint8_t *restrict src, uint8_t *restrict dst, ptrdiff_t stride)
 {
-    int x, y;
-
-    for (y = 0; y < 8; y++) {
-        for (x = 0; x < 8; x++)
-            dst[x] = src[area4 + 1 + y + x];
+    for (int y = 0; y < 8; y++) {
+        AV_COPY64U(dst, src + area4 + 1 + y);
         dst += stride;
     }
 }
 
 static void spatial_compensation_3(const uint8_t *restrict src, uint8_t *restrict dst, ptrdiff_t stride)
 {
-    int x, y;
-
-    for (y = 0; y < 8; y++) {
-        for (x = 0; x < 8; x++)
-            dst[x] = src[area4 + ((y + 1) >> 1) + x];
+    for (int y = 0; y < 8; y++) {
+        AV_COPY64U(dst, src + area4 + ((y + 1) >> 1));
         dst += stride;
     }
 }
@@ -274,11 +269,8 @@ static void spatial_compensation_5(const uint8_t *restrict src, uint8_t *restric
 
 static void spatial_compensation_6(const uint8_t *restrict src, uint8_t *restrict dst, ptrdiff_t stride)
 {
-    int x, y;
-
-    for (y = 0; y < 8; y++) {
-        for (x = 0; x < 8; x++)
-            dst[x] = src[area3 + x - y];
+    for (int y = 0; y < 8; y++) {
+        AV_COPY64U(dst, src + area3 - y);
         dst += stride;
     }
 }