Mercurial > mplayer.hg
changeset 17965:a1dc210f20b3
use shifts instead of division. 15% faster hqdn3d
author | lorenm |
---|---|
date | Sun, 26 Mar 2006 21:32:52 +0000 |
parents | 2a85c470cbd0 |
children | 916d035cec47 |
files | libmpcodecs/vf_hqdn3d.c |
diffstat | 1 files changed, 20 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/vf_hqdn3d.c Sun Mar 26 21:17:14 2006 +0000 +++ b/libmpcodecs/vf_hqdn3d.c Sun Mar 26 21:32:52 2006 +0000 @@ -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); } } }