[FFmpeg-cvslog] avfilter/vf_cropdetect: Unroll 3 & 4 bytes per sample loop

Michael Niedermayer git at videolan.org
Tue Dec 30 03:57:36 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Dec 30 02:35:32 2014 +0100| [5c7227bbb3c134979fb05d7f06cbc15cfcd3a1d4] | committer: Michael Niedermayer

avfilter/vf_cropdetect: Unroll 3 & 4 bytes per sample loop

19484 -> 10266 decicycles

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c7227bbb3c134979fb05d7f06cbc15cfcd3a1d4
---

 libavfilter/vf_cropdetect.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c
index 5b59dbd..abfbd1d 100644
--- a/libavfilter/vf_cropdetect.c
+++ b/libavfilter/vf_cropdetect.c
@@ -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;



More information about the ffmpeg-cvslog mailing list