[MPlayer-cvslog] CVS: main/libmpcodecs vf_hqdn3d.c,1.8,1.9
Loren Merritt CVS
syncmail at mplayerhq.hu
Sun Mar 26 23:32:55 CEST 2006
CVS change done by Loren Merritt CVS
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var2/tmp/cvs-serv30262
Modified Files:
vf_hqdn3d.c
Log Message:
use shifts instead of division. 15% faster hqdn3d
Index: vf_hqdn3d.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_hqdn3d.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- vf_hqdn3d.c 21 Mar 2006 21:26:41 -0000 1.8
+++ vf_hqdn3d.c 26 Mar 2006 21:32:52 -0000 1.9
@@ -69,7 +69,7 @@
static inline unsigned int LowPassMul(unsigned int PrevMul, unsigned int CurrMul, int* Coef){
// int dMul= (PrevMul&0xFFFFFF)-(CurrMul&0xFFFFFF);
int dMul= PrevMul-CurrMul;
- int d=((dMul+0x10007FF)/(65536/16));
+ int d=((dMul+0x10007FF)>>12);
return CurrMul + Coef[d];
}
@@ -81,13 +81,13 @@
int *Temporal)
{
int X, Y;
- int PixelDst;
+ unsigned int PixelDst;
for (Y = 0; Y < H; Y++){
for (X = 0; X < W; X++){
PixelDst = LowPassMul(FrameAnt[X]<<8, Frame[X]<<16, Temporal);
- FrameAnt[X] = ((PixelDst+0x1000007F)/256);
- FrameDest[X]= ((PixelDst+0x10007FFF)/65536);
+ FrameAnt[X] = ((PixelDst+0x1000007F)>>8);
+ FrameDest[X]= ((PixelDst+0x10007FFF)>>16);
}
Frame += sStride;
FrameDest += dStride;
@@ -105,16 +105,16 @@
int X, Y;
int sLineOffs = 0, dLineOffs = 0;
unsigned int PixelAnt;
- int PixelDst;
+ unsigned int PixelDst;
/* First pixel has no left nor top neighbor. */
PixelDst = LineAnt[0] = PixelAnt = Frame[0]<<16;
- FrameDest[0]= ((PixelDst+0x10007FFF)/65536);
+ FrameDest[0]= ((PixelDst+0x10007FFF)>>16);
/* First line has no top neighbor, only left. */
for (X = 1; X < W; X++){
PixelDst = LineAnt[X] = LowPassMul(PixelAnt, Frame[X]<<16, Horizontal);
- FrameDest[X]= ((PixelDst+0x10007FFF)/65536);
+ FrameDest[X]= ((PixelDst+0x10007FFF)>>16);
}
for (Y = 1; Y < H; Y++){
@@ -123,14 +123,14 @@
/* First pixel on each line doesn't have previous pixel */
PixelAnt = Frame[sLineOffs]<<16;
PixelDst = LineAnt[0] = LowPassMul(LineAnt[0], PixelAnt, Vertical);
- FrameDest[dLineOffs]= ((PixelDst+0x10007FFF)/65536);
+ FrameDest[dLineOffs]= ((PixelDst+0x10007FFF)>>16);
for (X = 1; X < W; X++){
- int PixelDst;
+ unsigned int PixelDst;
/* The rest are normal */
PixelAnt = LowPassMul(PixelAnt, Frame[sLineOffs+X]<<16, Horizontal);
PixelDst = LineAnt[X] = LowPassMul(LineAnt[X], PixelAnt, Vertical);
- FrameDest[dLineOffs+X]= ((PixelDst+0x10007FFF)/65536);
+ FrameDest[dLineOffs+X]= ((PixelDst+0x10007FFF)>>16);
}
}
}
@@ -145,7 +145,7 @@
int X, Y;
int sLineOffs = 0, dLineOffs = 0;
unsigned int PixelAnt;
- int PixelDst;
+ unsigned int PixelDst;
unsigned short* FrameAnt=(*FrameAntPtr);
if(!FrameAnt){
@@ -171,16 +171,16 @@
/* First pixel has no left nor top neighbor. Only previous frame */
LineAnt[0] = PixelAnt = Frame[0]<<16;
PixelDst = LowPassMul(FrameAnt[0]<<8, PixelAnt, Temporal);
- FrameAnt[0] = ((PixelDst+0x1000007F)/256);
- FrameDest[0]= ((PixelDst+0x10007FFF)/65536);
+ FrameAnt[0] = ((PixelDst+0x1000007F)>>8);
+ FrameDest[0]= ((PixelDst+0x10007FFF)>>16);
/* First line has no top neighbor. Only left one for each pixel and
* last frame */
for (X = 1; X < W; X++){
LineAnt[X] = PixelAnt = LowPassMul(PixelAnt, Frame[X]<<16, Horizontal);
PixelDst = LowPassMul(FrameAnt[X]<<8, PixelAnt, Temporal);
- FrameAnt[X] = ((PixelDst+0x1000007F)/256);
- FrameDest[X]= ((PixelDst+0x10007FFF)/65536);
+ FrameAnt[X] = ((PixelDst+0x1000007F)>>8);
+ FrameDest[X]= ((PixelDst+0x10007FFF)>>16);
}
for (Y = 1; Y < H; Y++){
@@ -191,17 +191,17 @@
PixelAnt = Frame[sLineOffs]<<16;
LineAnt[0] = LowPassMul(LineAnt[0], PixelAnt, Vertical);
PixelDst = LowPassMul(LinePrev[0]<<8, LineAnt[0], Temporal);
- LinePrev[0] = ((PixelDst+0x1000007F)/256);
- FrameDest[dLineOffs]= ((PixelDst+0x10007FFF)/65536);
+ LinePrev[0] = ((PixelDst+0x1000007F)>>8);
+ FrameDest[dLineOffs]= ((PixelDst+0x10007FFF)>>16);
for (X = 1; X < W; X++){
- int PixelDst;
+ unsigned int PixelDst;
/* The rest are normal */
PixelAnt = LowPassMul(PixelAnt, Frame[sLineOffs+X]<<16, Horizontal);
LineAnt[X] = LowPassMul(LineAnt[X], PixelAnt, Vertical);
PixelDst = LowPassMul(LinePrev[X]<<8, LineAnt[X], Temporal);
- LinePrev[X] = ((PixelDst+0x1000007F)/256);
- FrameDest[dLineOffs+X]= ((PixelDst+0x10007FFF)/65536);
+ LinePrev[X] = ((PixelDst+0x1000007F)>>8);
+ FrameDest[dLineOffs+X]= ((PixelDst+0x10007FFF)>>16);
}
}
}
More information about the MPlayer-cvslog
mailing list