Mercurial > mplayer.hg
changeset 1472:3182755fdee8
some optimization
author | arpi |
---|---|
date | Thu, 09 Aug 2001 18:39:43 +0000 |
parents | 00a1f4b77803 |
children | e5e6c26c1aa1 |
files | TOOLS/subfont-c/subfont.c |
diffstat | 1 files changed, 18 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/TOOLS/subfont-c/subfont.c Thu Aug 09 17:29:25 2001 +0000 +++ b/TOOLS/subfont-c/subfont.c Thu Aug 09 18:39:43 2001 +0000 @@ -362,37 +362,31 @@ for (x = 0; x<width; ++x) { float max = 0; for (my = -r; my<=r; ++my) - if (y+my>0 && y+my<height-1) + if (y+my>0 && y+my<height-1){ + int ay=(y+my)*width; for (mx = -r; mx<=r; ++mx) { - if (x+mx>0 && x+mx<width-1) { -// int p = buffer[x+mx+(y+my)*width] * m[mx+r+(my+r)*w]; - int p = 0; - - p = ( (buffer[x+mx-1+(y+my-1)*width]) + - (buffer[x+mx-1+(y+my+1)*width]) + - (buffer[x+mx+1+(y+my-1)*width]) + - (buffer[x+mx+1+(y+my+1)*width]) )/2 + + int ax=x+mx; + if (ax>0 && ax<width-1) { + int p = - ( (buffer[x+mx-1+(y+my)*width]) + - (buffer[x+mx+1+(y+my)*width]) + - (buffer[x+mx+(y+my-1)*width]) + - (buffer[x+mx+(y+my+1)*width]) + + ( (buffer[ax-1+ay-width]) + + (buffer[ax-1+ay+width]) + + (buffer[ax+1+ay-width]) + + (buffer[ax+1+ay+width]) )/2 + - (buffer[x+mx+(y+my)*width]) ) ; + ( (buffer[ax-1+ay]) + + (buffer[ax+1+ay]) + + (buffer[ax+ay-width]) + + (buffer[ax+ay+width]) + + + (buffer[ax+ay]) ) ; - if(p>255) p=255; - - // p*=m[mx+r+(my+r)*w]; - // if (p>max) { - // max = p; - // abuffer[x+y*width] = (p + maxcolor/2) / maxcolor; - // } - //max+=(p + maxcolor/2) / maxcolor; - max+=p*m[mx+r+(my+r)*w]/(float)sum; + max+=(p>255?255:p)*m[mx+r+(my+r)*w]; } } - max=max*alpha_factor; + } + max*=alpha_factor/(float)sum; // printf("%5.3f ",max); if(max>255) max=255; abuffer[x+y*width] = max;