Mercurial > libavcodec.hg
changeset 2038:02b59a3c62cd libavcodec
faster c lowpass filter
author | michael |
---|---|
date | Thu, 27 May 2004 16:16:09 +0000 |
parents | 98d8283534bb |
children | f25e485a7850 |
files | libpostproc/postprocess.c libpostproc/postprocess_template.c |
diffstat | 2 files changed, 39 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/libpostproc/postprocess.c Thu May 27 15:57:20 2004 +0000 +++ b/libpostproc/postprocess.c Thu May 27 16:16:09 2004 +0000 @@ -376,32 +376,32 @@ */ static inline void doHorizLowPass_C(uint8_t dst[], int stride, PPContext *c) { - int y; for(y=0; y<BLOCK_SIZE; y++) { const int first= ABS(dst[-1] - dst[0]) < c->QP ? dst[-1] : dst[0]; const int last= ABS(dst[8] - dst[7]) < c->QP ? dst[8] : dst[7]; - int sums[9]; - sums[0] = first + dst[0]; - sums[1] = dst[0] + dst[1]; - sums[2] = dst[1] + dst[2]; - sums[3] = dst[2] + dst[3]; - sums[4] = dst[3] + dst[4]; - sums[5] = dst[4] + dst[5]; - sums[6] = dst[5] + dst[6]; - sums[7] = dst[6] + dst[7]; - sums[8] = dst[7] + last; + int sums[10]; + sums[0] = 4*first + dst[0] + dst[1] + dst[2] + 4; + sums[1] = sums[0] - first + dst[3]; + sums[2] = sums[1] - first + dst[4]; + sums[3] = sums[2] - first + dst[5]; + sums[4] = sums[3] - first + dst[6]; + sums[5] = sums[4] - dst[0] + dst[7]; + sums[6] = sums[5] - dst[1] + last; + sums[7] = sums[6] - dst[2] + last; + sums[8] = sums[7] - dst[3] + last; + sums[9] = sums[8] - dst[4] + last; - dst[0]= ((sums[0]<<2) + ((first + sums[2])<<1) + sums[4] + 8)>>4; - dst[1]= ((dst[1]<<2) + ((first + sums[0] + sums[3])<<1) + sums[5] + 8)>>4; - dst[2]= ((dst[2]<<2) + ((first + sums[1] + sums[4])<<1) + sums[6] + 8)>>4; - dst[3]= ((dst[3]<<2) + ((sums[2] + sums[5])<<1) + sums[0] + sums[7] + 8)>>4; - dst[4]= ((dst[4]<<2) + ((sums[3] + sums[6])<<1) + sums[1] + sums[8] + 8)>>4; - dst[5]= ((dst[5]<<2) + ((last + sums[7] + sums[4])<<1) + sums[2] + 8)>>4; - dst[6]= (((last + dst[6])<<2) + ((dst[7] + sums[5])<<1) + sums[3] + 8)>>4; - dst[7]= ((sums[8]<<2) + ((last + sums[6])<<1) + sums[4] + 8)>>4; + dst[0]= (sums[0] + sums[2] + 2*dst[0])>>4; + dst[1]= (sums[1] + sums[3] + 2*dst[1])>>4; + dst[2]= (sums[2] + sums[4] + 2*dst[2])>>4; + dst[3]= (sums[3] + sums[5] + 2*dst[3])>>4; + dst[4]= (sums[4] + sums[6] + 2*dst[4])>>4; + dst[5]= (sums[5] + sums[7] + 2*dst[5])>>4; + dst[6]= (sums[6] + sums[8] + 2*dst[6])>>4; + dst[7]= (sums[7] + sums[9] + 2*dst[7])>>4; dst+= stride; }
--- a/libpostproc/postprocess_template.c Thu May 27 15:57:20 2004 +0000 +++ b/libpostproc/postprocess_template.c Thu May 27 16:16:09 2004 +0000 @@ -317,25 +317,26 @@ const int first= ABS(src[0] - src[l1]) < c->QP ? src[0] : src[l1]; const int last= ABS(src[l8] - src[l9]) < c->QP ? src[l9] : src[l8]; - int sums[9]; - sums[0] = first + src[l1]; - sums[1] = src[l1] + src[l2]; - sums[2] = src[l2] + src[l3]; - sums[3] = src[l3] + src[l4]; - sums[4] = src[l4] + src[l5]; - sums[5] = src[l5] + src[l6]; - sums[6] = src[l6] + src[l7]; - sums[7] = src[l7] + src[l8]; - sums[8] = src[l8] + last; - - src[l1]= ((sums[0]<<2) + ((first + sums[2])<<1) + sums[4] + 8)>>4; - src[l2]= ((src[l2]<<2) + ((first + sums[0] + sums[3])<<1) + sums[5] + 8)>>4; - src[l3]= ((src[l3]<<2) + ((first + sums[1] + sums[4])<<1) + sums[6] + 8)>>4; - src[l4]= ((src[l4]<<2) + ((sums[2] + sums[5])<<1) + sums[0] + sums[7] + 8)>>4; - src[l5]= ((src[l5]<<2) + ((sums[3] + sums[6])<<1) + sums[1] + sums[8] + 8)>>4; - src[l6]= ((src[l6]<<2) + ((last + sums[7] + sums[4])<<1) + sums[2] + 8)>>4; - src[l7]= (((last + src[l7])<<2) + ((src[l8] + sums[5])<<1) + sums[3] + 8)>>4; - src[l8]= ((sums[8]<<2) + ((last + sums[6])<<1) + sums[4] + 8)>>4; + int sums[10]; + sums[0] = 4*first + src[l1] + src[l2] + src[l3] + 4; + sums[1] = sums[0] - first + src[l4]; + sums[2] = sums[1] - first + src[l5]; + sums[3] = sums[2] - first + src[l6]; + sums[4] = sums[3] - first + src[l7]; + sums[5] = sums[4] - src[l1] + src[l8]; + sums[6] = sums[5] - src[l2] + last; + sums[7] = sums[6] - src[l3] + last; + sums[8] = sums[7] - src[l4] + last; + sums[9] = sums[8] - src[l5] + last; + + src[l1]= (sums[0] + sums[2] + 2*src[l1])>>4; + src[l2]= (sums[1] + sums[3] + 2*src[l2])>>4; + src[l3]= (sums[2] + sums[4] + 2*src[l3])>>4; + src[l4]= (sums[3] + sums[5] + 2*src[l4])>>4; + src[l5]= (sums[4] + sums[6] + 2*src[l5])>>4; + src[l6]= (sums[5] + sums[7] + 2*src[l6])>>4; + src[l7]= (sums[6] + sums[8] + 2*src[l7])>>4; + src[l8]= (sums[7] + sums[9] + 2*src[l8])>>4; src++; }