diff options
author | 2001-08-09 18:39:43 +0000 | |
---|---|---|
committer | 2001-08-09 18:39:43 +0000 | |
commit | 4aa85931f9cff59f559baaff52ae41f156809cdb (patch) | |
tree | 1cc74133742925e08c6b7e01cea3fc3401512315 /TOOLS/subfont-c/subfont.c | |
parent | e59978c8ce544a4a28520844169cd9988b8866ae (diff) |
some optimization
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1473 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'TOOLS/subfont-c/subfont.c')
-rw-r--r-- | TOOLS/subfont-c/subfont.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/TOOLS/subfont-c/subfont.c b/TOOLS/subfont-c/subfont.c index 358d0bb5a7..15a2a3bb89 100644 --- a/TOOLS/subfont-c/subfont.c +++ b/TOOLS/subfont-c/subfont.c @@ -362,37 +362,31 @@ void blur() { 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; + int ax=x+mx; + if (ax>0 && ax<width-1) { + int p = - 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 + + ( (buffer[ax-1+ay-width]) + + (buffer[ax-1+ay+width]) + + (buffer[ax+1+ay-width]) + + (buffer[ax+1+ay+width]) )/2 + - ( (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]) + + (buffer[ax+1+ay]) + + (buffer[ax+ay-width]) + + (buffer[ax+ay+width]) + - (buffer[x+mx+(y+my)*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; |