shithub: hj264

Download patch

ref: cad6611cd489fd7214576800cd5e461a51a7e60a
parent: 863d39cf56bed39b22cfc1370c94654b0890a7d0
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Jul 26 15:43:20 EDT 2022

copy_wh: specify for w == 4

--- a/minih264e.h
+++ b/minih264e.h
@@ -6493,14 +6493,27 @@
 static void copy_wh(const uint8_t *src, int src_stride, uint8_t *dst, int w, int h)
 {
     int x, y;
-    for (y = 0; y < h; y++)
+    if (w == 4)
     {
-        for (x = 0; x < w; x++)
+        do
         {
-            dst [x] = src [x];
+            *(int32_t*)dst = *(int32_t*)src; dst += 16; src += src_stride;
+            *(int32_t*)dst = *(int32_t*)src; dst += 16; src += src_stride;
+            *(int32_t*)dst = *(int32_t*)src; dst += 16; src += src_stride;
+            *(int32_t*)dst = *(int32_t*)src; dst += 16; src += src_stride;
+        } while (h -= 4);
+    }
+    else
+    {
+        for (y = 0; y < h; y++)
+        {
+            for (x = 0; x < w; x++)
+            {
+                dst [x] = src [x];
+            }
+            dst += 16;
+            src += src_stride;
         }
-        dst += 16;
-        src += src_stride;
     }
 }