avfilter/vf_cropdetect: Unroll 3 & 4 bytes per sample loop
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 30 Dec 2014 01:35:32 +0000 (02:35 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 30 Dec 2014 01:39:36 +0000 (02:39 +0100)
19484 -> 10266 decicycles

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/vf_cropdetect.c

index 5b59dbd..abfbd1d 100644 (file)
@@ -81,6 +81,14 @@ static int checkline(void *ctx, const unsigned char *src, int stride, int len, i
         break;
     case 3:
     case 4:
+        while (len >= 4) {
+            total += src[0]        + src[1         ] + src[2         ]
+                  +  src[  stride] + src[1+  stride] + src[2+  stride];
+                  +  src[2*stride] + src[1+2*stride] + src[2+2*stride];
+                  +  src[3*stride] + src[1+3*stride] + src[2+3*stride];
+            src += 4*stride;
+            len -= 4;
+        }
         while (--len >= 0) {
             total += src[0] + src[1] + src[2];
             src += stride;