Commit 3407a972 authored by Michael Niedermayer's avatar Michael Niedermayer

c speedup (x1, rk1 filters)

Originally committed as revision 2587 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
parent 02a0a992
...@@ -670,20 +670,19 @@ static inline void vertRK1Filter(uint8_t *src, int stride, int QP) ...@@ -670,20 +670,19 @@ static inline void vertRK1Filter(uint8_t *src, int stride, int QP)
// const int l8= stride + l7; // const int l8= stride + l7;
// const int l9= stride + l8; // const int l9= stride + l8;
int x; int x;
const int QP15= QP + (QP>>2);
src+= stride*3; src+= stride*3;
for(x=0; x<BLOCK_SIZE; x++) for(x=0; x<BLOCK_SIZE; x++)
{ {
if(ABS(src[l4]-src[l5]) < QP + QP/4) const int v = (src[x+l5] - src[x+l4]);
if(ABS(v) < QP15)
{ {
int v = (src[l5] - src[l4]); src[x+l3] +=v>>3;
src[x+l4] +=v>>1;
src[l3] +=v/8; src[x+l5] -=v>>1;
src[l4] +=v/2; src[x+l6] -=v>>3;
src[l5] -=v/2;
src[l6] -=v/8;
} }
src++;
} }
#endif #endif
...@@ -803,18 +802,19 @@ static inline void vertX1Filter(uint8_t *src, int stride, int QP) ...@@ -803,18 +802,19 @@ static inline void vertX1Filter(uint8_t *src, int stride, int QP)
int b= src[l4] - src[l5]; int b= src[l4] - src[l5];
int c= src[l5] - src[l6]; int c= src[l5] - src[l6];
int d= MAX(ABS(b) - (ABS(a) + ABS(c))/2, 0); int d= ABS(b) - ((ABS(a) + ABS(c))>>1);
d= MAX(d, 0);
if(d < QP) if(d < QP)
{ {
int v = d * SIGN(-b); int v = d * SIGN(-b);
src[l2] +=v/8; src[l2] +=v>>3;
src[l3] +=v/4; src[l3] +=v>>2;
src[l4] +=3*v/8; src[l4] +=(3*v)>>3;
src[l5] -=3*v/8; src[l5] -=(3*v)>>3;
src[l6] -=v/4; src[l6] -=v>>2;
src[l7] -=v/8; src[l7] -=v>>3;
} }
src++; src++;
......
...@@ -670,20 +670,19 @@ static inline void vertRK1Filter(uint8_t *src, int stride, int QP) ...@@ -670,20 +670,19 @@ static inline void vertRK1Filter(uint8_t *src, int stride, int QP)
// const int l8= stride + l7; // const int l8= stride + l7;
// const int l9= stride + l8; // const int l9= stride + l8;
int x; int x;
const int QP15= QP + (QP>>2);
src+= stride*3; src+= stride*3;
for(x=0; x<BLOCK_SIZE; x++) for(x=0; x<BLOCK_SIZE; x++)
{ {
if(ABS(src[l4]-src[l5]) < QP + QP/4) const int v = (src[x+l5] - src[x+l4]);
if(ABS(v) < QP15)
{ {
int v = (src[l5] - src[l4]); src[x+l3] +=v>>3;
src[x+l4] +=v>>1;
src[l3] +=v/8; src[x+l5] -=v>>1;
src[l4] +=v/2; src[x+l6] -=v>>3;
src[l5] -=v/2;
src[l6] -=v/8;
} }
src++;
} }
#endif #endif
...@@ -803,18 +802,19 @@ static inline void vertX1Filter(uint8_t *src, int stride, int QP) ...@@ -803,18 +802,19 @@ static inline void vertX1Filter(uint8_t *src, int stride, int QP)
int b= src[l4] - src[l5]; int b= src[l4] - src[l5];
int c= src[l5] - src[l6]; int c= src[l5] - src[l6];
int d= MAX(ABS(b) - (ABS(a) + ABS(c))/2, 0); int d= ABS(b) - ((ABS(a) + ABS(c))>>1);
d= MAX(d, 0);
if(d < QP) if(d < QP)
{ {
int v = d * SIGN(-b); int v = d * SIGN(-b);
src[l2] +=v/8; src[l2] +=v>>3;
src[l3] +=v/4; src[l3] +=v>>2;
src[l4] +=3*v/8; src[l4] +=(3*v)>>3;
src[l5] -=3*v/8; src[l5] -=(3*v)>>3;
src[l6] -=v/4; src[l6] -=v>>2;
src[l7] -=v/8; src[l7] -=v>>3;
} }
src++; src++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment