summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_hqdn3d.c
diff options
context:
space:
mode:
authorlorenm <lorenm@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-03-26 21:32:52 +0000
committerlorenm <lorenm@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-03-26 21:32:52 +0000
commitf9ed90fb61048c38428ff1da2daca590a24e8c1c (patch)
tree44b19df079ad652cf29c5e1dbba2afd05efc5f72 /libmpcodecs/vf_hqdn3d.c
parent338e4f8b76f8adce21dc3a7b5db98ca73a283072 (diff)
downloadmpv-f9ed90fb61048c38428ff1da2daca590a24e8c1c.tar.bz2
mpv-f9ed90fb61048c38428ff1da2daca590a24e8c1c.tar.xz
use shifts instead of division. 15% faster hqdn3d
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17966 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vf_hqdn3d.c')
-rw-r--r--libmpcodecs/vf_hqdn3d.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/libmpcodecs/vf_hqdn3d.c b/libmpcodecs/vf_hqdn3d.c
index 2c13f4b31d..22a1526a0f 100644
--- a/libmpcodecs/vf_hqdn3d.c
+++ b/libmpcodecs/vf_hqdn3d.c
@@ -69,7 +69,7 @@ static int config(struct vf_instance_s* vf,
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 @@ static void deNoiseTemporal(
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 @@ static void deNoiseSpacial(
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 @@ static void deNoiseSpacial(
/* 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 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x]
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 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x]
/* 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 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x]
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);
}
}
}