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

19484 -> 10266 decicycles

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/101/head
Michael Niedermayer 10 years ago
parent 60e2c3110a
commit 5c7227bbb3
  1. 8
      libavfilter/vf_cropdetect.c

@ -81,6 +81,14 @@ static int checkline(void *ctx, const unsigned char *src, int stride, int len, i
break; break;
case 3: case 3:
case 4: 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) { while (--len >= 0) {
total += src[0] + src[1] + src[2]; total += src[0] + src[1] + src[2];
src += stride; src += stride;

Loading…
Cancel
Save