From 60e2c3110ae338fb7ea545f317f952df5acbb349 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 30 Dec 2014 02:31:10 +0100 Subject: [PATCH] avfilter/vf_cropdetect: Unroll 1byte per sample loop 12807 -> 6336 decicycles Signed-off-by: Michael Niedermayer --- libavfilter/vf_cropdetect.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index fb7be8e240..5b59dbd5dc 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -68,6 +68,12 @@ static int checkline(void *ctx, const unsigned char *src, int stride, int len, i switch (bpp) { case 1: + while (len >= 8) { + total += src[ 0] + src[ stride] + src[2*stride] + src[3*stride] + + src[4*stride] + src[5*stride] + src[6*stride] + src[7*stride]; + src += 8*stride; + len -= 8; + } while (--len >= 0) { total += src[0]; src += stride;